[OpenSIPS-Users] Parse initial INVITE Request-URI

Răzvan Crainea razvan at opensips.org
Tue Dec 16 10:13:43 CET 2014


Hi, James!

You can access the username in the R-URI with the $rU variable. Next, 
you can use the uac_replace_to()[1] function to change the To header.

[1] http://www.opensips.org/html/docs/modules/2.1.x/uac.html#id293640

Best regards,

Răzvan Crainea
OpenSIPS Solutions
www.opensips-solutions.com

On 12/12/2014 10:18 PM, discodog62 at aol.com wrote:
> The call is coming in from an entity located before Opensips.
> What I would like to do is grab the toll-free number from the initial INVITE
>   INVITE sip:+18552223333 at 111.222.333.444  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>:5060 SIP/2.0
> then update the To: address to be the toll-free number not the local number 8585554444.
>
>
> I have found that I can see the initial INVITE info if dump the buffer $mb.  How can I search using a regex expression and return the match so I can update $tU.  Is that possible?
>
>
> Thanks,
> James
>
>
> Hello,
>
> Who is doing the actual forward ? Is it a SIP proxy / entity located
> before OpenSIPS ?
>
> Just by looking at the INVITE message you've posted, the originally
> dialled number ( 8585554444 ) is located in the TO username ( readable
> via the $tU variable in the script ).
>
> Best Regards,
>
> Vlad Paiu
> OpenSIPS Developer
> http://www.opensips-solutions.com  <http://www.opensips-solutions.com/>
>
> On 12.12.2014 03:57,discodog62 at aol.com  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>  wrote:
> >/  Good day to all.
> />/  Here is what I am trying to do and I am hoping someone can set me in
> />/  the right direction.  I am using Opensips 1.11.2
> />/
> />/  I have an inbound SIP call.  This call is actually a forward.  When I
> />/  dial the number 8585554444 it is forwarded to 8585554444.
> />/
> />/  Dialed number: 8585554444 forwards to 18552223333
> />/
> />/  When the call comes in Opensips this is my initial invite...
> />/
> />/
> />/  INVITE sip:+18552223333 at 111.222.333.444  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>:5060 SIP/2.0
> />/  Via: SIP/2.0/UDP 11.11.11.11:5060;branch=z9hG4bK08B4ca619b00ce6405c
> />/  From: <sip:+18586669999 at 11.11.11.11  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>:5060;isup-oli=0>;tag=gK084a85fd
> />/  To: <sip:8585554444 at 111.222.333.444  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>:5060>
> />/  Call-ID:537432242_53736858 at 11.11.11.11  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
> />/  CSeq: 17719 INVITE
> />/  Max-Forwards: 93
> />/  Allow: INVITE,ACK,CANCEL,BYE,PRACK,UPDATE
> />/  Accept: application/sdp, application/isup, application/dtmf,
> />/  application/dtmf-relay,  multipart/mixed
> />/  Contact: <sip:+18586669999 at 11.11.11.11  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>:5060>
> />/  P-Asserted-Identity: <sip:+18586669999 at 11.11.11.11  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>:5060>
> />/  Diversion: <sip:+18585554444 at 11.11.11.11  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>:5060>;privacy=off;screen=no;
> />/  reason=no-answer; counter=1
> />/  Supported: 100rel
> />/  Content-Length:  200
> />/  Content-Disposition: session; handling=required
> />/  Content-Type: application/sdp
> />/
> />/  I see that the initial INVITE shows the toll free number that the call
> />/  was forwarded to but the TO: shows the original dialed number.
> />/  My question is can I grab the phone number from the initial INVITE?  I
> />/  have goggled around and tried using the search but it just returns a 1
> />/  or 0 for a match.  I know once I am able to grab the number from the
> />/  INVITE can then update the TO:field.  I have dumped out almost all of
> />/  the vars from Opensips and none of them show me the phone number from
> />/  the initial INVITE.
> />/
> />/  Any help is appreciated.
> />/
> />/  Thanks,
> />/
> />/
> />/  James
> />/
> />/
> />/
> />/  _______________________________________________
> />/  Users mailing list
> />/  Users at lists.opensips.org  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
> />/  http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> /
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.opensips.org/pipermail/users/attachments/20141212/4edf7d23/attachment.htm>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20141216/2e536355/attachment.htm>


More information about the Users mailing list