Menu

#50 Run-time RFC2833 DTMF generation patch

open
nobody
sipp (50)
5
2014-08-18
2011-02-07
No

The patch allows to send inband DTMF codes to remote party over RTP using RTP EVENT messages described in RFC2833 by specifying the following expressions in the XML scenarios:
<action>
<exec play_dtmf="42108#" />
</action>
or even
<exec play_dtmf="[field0]#" />

Variable expansion and all other stuff is also supported.

The patch uses the existing pcap replay engine, but constructs RFC2833 RTP packets on the fly for each call. The code also takes care of putting correct sequence numbers into the packets if play_dtmf is used multiple times during a call.
You can change the duration of the tones by specifying it after a comma, like this: <exec play_dtmf=”[field0],500” />. Default value is 200 ms, and values between 50 and 2000 are accepted. The inter-digit delay is the same as the tone duration.
The patch uses a hard-coded value of 96 for dynamic RTP payload type, so your SDP has to account for that.

To enable this functionality:
1) Download and unpack sipp.svn.tar.gz
2) Apply the patch
3) Compile with pcap support (make pcapplay)

To use in a scenario:
1) Make sure your SDP accounts for RTP payload 96:
m=audio [media_port] RTP/AVP 96 0
a=rtpmap:0 PCMU/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
2) Put <exec play_dtmf=”….” /> in an <action> clause where appropriate, similarly to <exec play_pcap_audio… />
3) Make sure to put a decent <pause /> after play_dtmf, because the tones are played asynchronously in background.

Discussion

  • Dmitry Kunilov

    Dmitry Kunilov - 2011-02-07

    dtmf patch

     
    • Waqas Shoukat

      Waqas Shoukat - 2015-07-15

      Can you tell me how i apply this patch im facing probelm in applying this patch

       
  • dev-jam

    dev-jam - 2012-05-06

    hi dkunilov,

    Fantastic addition!
    Didn't work for me 'out of the box' though.

    2 changes in the prepare_pcap.c file:
    1. In the void free_pkts(pcap_pkts *pkts) method:
    -> had to make sure pkt_index was pointing at pcap_pkt ( pcap_pkt *pkt_index;)
    -> made sure all packets were cleaned by adding pkt_index++;

    2. in the rtphdr:
    both timestamp and ssrcid should be 32 bit.
    by using ulong they are 64 bit which completely misaligned the rtp payload

    I changed both to u_int32_t and now I'm rocking!

    Not sure if I am the only one who had these issues but this worked for me.

    Thanks for the patch. Really a timesaver!

     
  • Michael Dresser

    Michael Dresser - 2013-04-09

    hi,
    Can someone please explain to me how to patch the file. I have tried running the following.

    patch actions.cpp sipp-dtmf-0.2-patch

    But this results in failures such as.
    Hunk #1 FAILED at 413
    HUNK #2 FAILED at 3785

    I'm pretty new to linux so would appreciated any help.

    Thanks

    MD

     

Log in to post a comment.