[asterisk-users] Fwd: Asterisk pjsip auto dtmf mode
Matthew Jordan
mjordan at digium.com
Mon Jan 19 09:33:46 CST 2015
On Sat, Jan 17, 2015 at 12:04 AM, Yaron Nachum <nachum.yaron at gmail.com>
wrote:
> Hello Asterisk Users,
> I have been looking for similar auto dtmf mode implementation on pjsip,
> but didn't see it coming, so I decided to give it a try.
> My basic plan was to do it as simple as possible with minimum changes
> because I am not familiar with all Asterisk code. My idea is to use rfc4733
> settings, but when going over the codecs check if telephone-event appear
> and if not set the dtmf mode to inband on rtp instance.
> I would appreciate if someone would look at what I did and see if I didn't
> do stupid things. If you think this is something you would like to add to
> one of the next releases I am willing to help - add the additional dtmf
> mode ...
> I based my development on 13.1.0. The following are my changes:
>
> In res/res_pjsip_sdp_rtp.c (I added session_media to get_codecs and used
> it in order to update dtmf settings on rtp instance when telephone-event is
> not included in the sdp):
> 150:
> static void get_codecs(struct ast_sip_session *session, const struct
> pjmedia_sdp_media *stream, struct ast_rtp_codecs *codecs, struct
> ast_sip_session_media *session_media)
> 159:
> char fmt_param[256];
> int tel_event = 0;
> 177:
> ast_copy_pj_str(name, &rtpmap->enc_name, sizeof(name));
> if (strcmp(name,"telephone-event") == 0) {
> tel_event++;
> }
> 202:
> }
> if (tel_event==0) {
> ast_rtp_instance_dtmf_mode_set(session_media->rtp,
> AST_RTP_DTMF_MODE_INBAND);
> }
> /* Get the packetization, if it exists */
> 241:
> get_codecs(session, stream, &codecs, session_media);
>
> In res/res_pjsip_session.c (Just activated DSP also on RFC dtmf mode - I
> didn't find a way to test the rtp instance dtmf settiings because
> session_media pointer is not there. Any advice for doing so would be
> appreciated):
> 1062:
> if (endpoint->dtmf == AST_SIP_DTMF_INBAND || endpoint->dtmf ==
> AST_SIP_DTMF_RFC_4733) {
> dsp_features |= DSP_FEATURE_DIGIT_DETECT;
> }
>
> In channels/chan_pjsip.c (1 change similar to the above, and 2 more
> changes to send inband dtmf when rtp instance dtmf settings is inband)
> 543:
> if (session->endpoint->dtmf == AST_SIP_DTMF_INBAND ||
> session->endpoint->dtmf == AST_SIP_DTMF_RFC_4733) {
> ast_dsp_set_features(session->dsp,
> DSP_FEATURE_DIGIT_DETECT);
> 1420:
> if (!media || !media->rtp ||
> (ast_rtp_instance_dtmf_mode_get(media->rtp) == AST_RTP_DTMF_MODE_INBAND))
> {
> return -1;
> 1523:
> if (!media || !media->rtp ||
> (ast_rtp_instance_dtmf_mode_get(media->rtp) == AST_RTP_DTMF_MODE_INBAND))
> {
> return -1;
>
> That's it!!! It works fine for me. Any remarks / advice would be
> appreciated.
>
>
Hey Yaron:
Sounds like a good contribution. Since it is a code change, you may want to
discuss it further over on the asterisk-dev list.
If you're interested in submitting the contribution upstream to the
project, you can find instructions on the Asterisk wiki:
https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process
Thanks!
Matt
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20150119/0a1578bf/attachment.html>
More information about the asterisk-users
mailing list