[mythtv] MythPhone and Asterisk

Christophe Guerin christophe.guerin at eikonex.net
Thu Aug 11 14:28:00 UTC 2005


This patch enable MythPhone to send DTMFs to Asterisk.
(www.asterisk.org)
Consider this patch suitably disclaimed, and without any warranty
whatsoever.

----The beginning of the patch------

--- rtp.cpp.orig        2005-08-11 15:50:31.000000000 +0200
+++ rtp.cpp             2005-08-11 16:14:02.000000000 +0200
@@ -1448,22 +1448,25 @@

         if (digit != ' ')
         {
-            //cout << "Sending DTMF digit " << digit << endl;
-            RTPPACKET dtmfPacket;
-            DTMF_RFC2833 *dtmf = (DTMF_RFC2833 *)(dtmfPacket.RtpData);
+            for (int i=0;i<3;i++)
+           {
+               //cout << "Sending DTMF digit " << digit << endl;
+               RTPPACKET dtmfPacket;
+               DTMF_RFC2833 *dtmf = (DTMF_RFC2833
*)(dtmfPacket.RtpData);

-            dtmf->dtmfDigit = CHAR2DTMF(digit);
-            dtmf->dtmfERVolume = 0x0A; // 0x0A | RTP_DTMF_EBIT; //
Volume=10; E-bit set indicating end of event
-            dtmf->dtmfDuration = htons(0x0500); // Duration = 16ms
-
-            txSequenceNumber += 1; // Increment seq-num; don't
increment timestamp
-            dtmfPacket.RtpVPXCC = 128;
-            dtmfPacket.RtpMPT = dtmfPayload |
RTP_PAYLOAD_MARKER_BIT; // Set for 1st tx of a digit, clear for
retransmissions
-            dtmfPacket.RtpSequenceNumber = htons(txSequenceNumber);
-            dtmfPacket.RtpTimeStamp = htonl(txTimeStamp);
-            dtmfPacket.RtpSourceID = 0x666;
+               dtmf->dtmfDigit = CHAR2DTMF(digit);
+               dtmf->dtmfERVolume = 0x0A; // 0x0A | RTP_DTMF_EBIT; //
Volume=10; E-bit set indicating end of event
+               dtmf->dtmfDuration = htons(0x0500); // Duration = 16ms
+
+               txSequenceNumber += 1; // Increment seq-num; don't
increment timestamp
+               dtmfPacket.RtpVPXCC = 128;
+               dtmfPacket.RtpMPT = dtmfPayload |
RTP_PAYLOAD_MARKER_BIT; // Set for 1st tx of a digit, clear for
retransmissions
+               dtmfPacket.RtpSequenceNumber = htons(txSequenceNumber);
+               dtmfPacket.RtpTimeStamp = htonl(txTimeStamp);
+               dtmfPacket.RtpSourceID = 0x666;

-            rtpSocket->writeBlock((char *)&dtmfPacket.RtpVPXCC,
RTP_HEADER_SIZE+sizeof(DTMF_RFC2833), yourIP, yourPort);
+               rtpSocket->writeBlock((char *)&dtmfPacket.RtpVPXCC,
RTP_HEADER_SIZE+sizeof(DTMF_RFC2833), yourIP, yourPort);
+           }
         }
     }
 }


---- the end of the patch ----

P.S. : I sent it there, because the developper doesn't seems to change
the source.



More information about the mythtv-dev mailing list