Summary:ASTERISK-04845: [patch] Added support for custom URI options in INVITE
Reporter:Philip Walls (malverian)Labels:
Date Opened:2005-08-16 10:12:22Date Closed:2005-09-01 19:02:01
Versions:Frequency of
Environment:Attachments:( 0) chan_sip_uri_option.patch
( 1) uri_option_and_initreqprep_fix.patch
Description:Added a var _URI_OPTIONS and modified "initreqprep" to allow setting additional uri options for INVITE commands.

In my opinion initreqprep should be modified to just accept the entire sip_invite_param structure as an argument, but I don't have the time to do this.

This patch allows one to do the following:


which would modify the To: field of the invite to be <sip:user@realm;intercom=true>

It's functionally similar to _VXML_URL, the only difference being that it modifies the URI options.

Essentially: <sip:user@realm[[URI_OPTIONS]]>[[VXML_URL]]
Comments:By: Michael Jerris (mikej) 2005-08-16 10:19:58

1.  We need a disclaimer to even review this.
2.  Would this be better suited to be part of one of the sip-specific fuctions used for setting and retriving specific info?

By: Olle Johansson (oej) 2005-08-16 10:29:52

This is an interesting patch, but needs some more consideration. Let's come back to this after 1.2.

By: Philip Walls (malverian) 2005-08-16 10:30:59

1. I will sign and fax when I receive clarification from Keith on a few concerns I have with the disclaimer, until then I do not have the time to keep this patch in sync with CVS, regardless of how small the changes are.

2. Provided said functions are capable of changing the sip URI, then yes. I implemented it this way simply because it was a quick, less hack-y way of accomplishing Snom intercom support than a post to the mailing lists I saw. Hopefully using generic URI_OPTION will have a broader use than just for Snom users.

By: xrobau (xrobau) 2005-08-19 02:42:59

Minor Snom intercom note - Doing this also achives intercom:
exten => 99,1,SIPAddHeader(Call-Info: answer-after=0)
exten => 99,2,Dial(SIP/yoursnom)

You also need to ensure that 'Filter Packets from Registrar' is switched to _off_.

By: Michael Jerris (mikej) 2005-08-19 08:50:47

malverian, does SIPAddHeader solve your problem?

By: Philip Walls (malverian) 2005-08-19 18:40:38

Actually, doing this does not seem to work for my (up to date firmware) SNOM 320, even with the "Filter Packets" turned to OFF. In reality, even doing this _and_ the "intercom=true" hack in the SIP URI does not make the phone pick up on answer.

Am I perhaps missing something? I've searched and asked around quite a bit and haven't been able to get a solid working answer.

By: xrobau (xrobau) 2005-08-30 04:41:39

Sorry for the delay in getting back to you. This actually, and is tested, works.

exten => 555,1,SIPAddHeader(Call-Info: sip:\; answer-after=0)
exten => 555,2,Dial(SIP/303)

Where is the IP address of the Registrar of Line 1. Make sure that 'filter packets from registrar' is _off_ and 'enable intercom' is on.

Snom's technical support does leave some room for improvement, but they do actually, eventually, give you the right information.

By: Michael Jerris (mikej) 2005-08-30 08:09:56

bug suspended until we receive a disclaimer.  Please re-open when the disclaimer is submitted.

By: Philip Walls (malverian) 2005-08-30 19:43:41

Faxed disclaimer.

- Updated patch to work with latest HEAD.
- Modified initreqprep to no longer have vxml_url as option (now pulls from p->options which is already passed

Will upload latest patch once bug is reopened

By: Philip Walls (malverian) 2005-08-30 19:53:23

The newest patch (uri_option_and_initreqprep_fix.patch) now works properly for getting automatic answer in Snom phones thanks to oej's commit this evening which made it so the sip_invite_param structure is now included in sip_pvt (sip_pvt->options), and also ensured that the same options are passed future INVITEs such as when authentication is requested (do_proxy_auth).

The patch also includes some cleaning up of the way initreqprep is called, we no longer need to pass p->options->vxml_url separately since p is already passed.

Patch applies cleanly to latest CVS as of 08/30 20:00:00

By: Michael Jerris (mikej) 2005-08-31 00:16:55

changing this to minor as it fixes rfc non compliance on how we were handling vxml_url previously.

By: Olle Johansson (oej) 2005-08-31 17:40:28

Recommended for cvs

By: Kevin P. Fleming (kpfleming) 2005-09-01 19:01:43

Committed to CVS HEAD with mods:

- SIP_URI_OPTIONS, not URI_OPTIONS, since this is SIP-specific

- reworked the building of the URI to use ast_build_string, which reduced duplication