[Freeswitch-users] sip_invite_from_params

Michael Collins msc at freeswitch.org
Tue Feb 7 23:04:38 MSK 2012


Technically that is not a big issue, however I will explain it for the sake
of discussion. The ^ and $ are "anchors" for the beginning and end of the
string. Consider these patterns:

\d (match a single digit)
\d+ (match one or more digits)
^\d+ (match a string that begins with one or more digits)
\d+$ (match a string that ends with one or more digits)
^\d+$ (match a string that contains only one or more digits)

So, the pattern ^(\d+) literally means:
"Match a string that begins with one or more digits and capture those
digits into the variable $1."

The only issue with not having a $ at the end of the pattern is that there
could be other stuff in the string after the digits. For example, these
strings would all match the pattern "^(\d+)":

1x
43abc
12345abcd
998877LA_LA_LA_WHATEVER
18005551212!hoohah

If you added the $ at the end of the pattern then none of the above strings
would match.

Hope that makes sense....

-MC

On Tue, Feb 7, 2012 at 11:46 AM, Bote Man <bote_radio at botecomm.com> wrote:

> I am an absolute newbie to FS, but from reading about dialplan regular
> expressions this morning I would guess that this line:
>
>  <condition field="caller_id_number" expression="^(\d+)">
>
> is missing the required trailing "$" to end the regular expression.
>
> It should be:
>  <condition field="caller_id_number" expression="^(\d+)$">
>
> no?
>
> Bote
>
>
> > -----Original Message-----
> > From: freeswitch-users-bounces at lists.freeswitch.org
> > [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of
> > George Sapak
> > Sent: Tuesday, 07 February, 2012 11:30
> > To: FreeSWITCH Users Help
> > Subject: Re: [Freeswitch-users] sip_invite_from_params
> >
> > i already have it setup, my calls go through to the right extensions
> > and I have done some rewitting in public.xml file, but I have having
> > some wierdness on the handsets with call ID, when the phone rings the
> > ID show correctly but when its picked up it shows it with the
> > ;national... sting included.
> >
> > Here is how I have done the routing and rewritte:
> >
> >
> > <extension name="105">
> >    <condition expression="public" field="context"/>
> >    <condition field="destination_number"
> > expression="^403XXXXXXX(.+)$">
> >    <action application="transfer" data="105 XML default"/>
> >    </condition>
> > </extension>
> >
> > public.xml
> > <extension name="set caller id" continue="true">
> > <condition field="caller_id_number" expression="^(\d+)">
> >  <action application="set" data="caller_id_number=$1"/>
> >  <action application="set" data="effective_caller_id_number=$1"/>
> > </condition>
> > </extension>
> >
> >
> > Thank You,
> > George
> >
> > ----- Original Message -----
> > From: "Brian West" <brian at freeswitch.org>
> > To: "FreeSWITCH Users Help" <freeswitch-users at lists.freeswitch.org>
> > Sent: Tuesday, February 7, 2012 8:43:54 AM
> > Subject: Re: [Freeswitch-users] sip_invite_from_params
> >
> >
> > Why? What is your goal? This should be a simple dialplan rewrite
> > really.
> >
> >
> > /b
> >
> >
> >
> > On Feb 7, 2012, at 9:27 AM, George Sapak wrote:
> >
> >
> > can someone give me an example in use, I have looked at the wiki and
> > its pretty unclear, I am trying to remove a string in an invite ->
> > ;phone-context=national
> >
> > INVITE sip:403XXXXXXX;phone-context=national at 10.185.16.170;user=phone
> > SIP/2.0
> > Via: SIP/2.0/UDP
> > 10.185.16.169:5060;branch=z9hG4bKght6ecqg4eh7d5sluaj9cl2rr4
> > From: "Caller"< sip:403YYYYYYY;phone-
> > context=national at 10.185.16.169;user=phone;isup-oli=00 >;tag=SDj6q1a01-
> > 98964
> > To: < sip:403XXXXXXX;phone-context=national at 10.185.16.170;user=phone >
> > Call-ID: SDj6q1a01-2afa0c6426482b0cfa2885f32878c86c-o0t3g30
> > CSeq: 62218 INVITE
> > Content-Type: application/sdp
> > Contact: < sip:403YYYYYYY;phone-
> > context=national at 10.185.16.169:5060;transport=udp >
> > User-Agent: Nortel SESM 14.0.6.0
> > Max-Forwards: 19
> > Supported: com.nortelnetworks.firewall,p-3rdpartycontrol,nosec,join,x-
> > nortel-sipvc,com.nortelnetworks.im.encryption,r eplaces,100rel,tdialog
> > Allow: UPDATE,REFER
> > x-nt-corr-id: 871f3514-29e7-1b21-a633-000e0cb7d3a0
> > x-nt-location: -1
> > Content-Length: 206
> > Route: < sip:403XXXXXXX;phone-
> > context=national at 10.185.16.170:5060;user=phone;lr >
> >
> >
> > Thank You,
> > George
> >
> > --
> > Brian West
> > FreeSWITCH Solutions, LLC
> > Phone: +1 (918) 420-9266
> > Fax: +1 (918) 420-9267
> > brian at freeswitch.org
> > http://www.freeswitch.org
> >
> > ______________________________________________________________________
> > ___
> > Professional FreeSWITCH Consulting Services:
> > consulting at freeswitch.org
> > http://www.freeswitchsolutions.com
> >
> > 
> > 
> >
> > Official FreeSWITCH Sites
> > http://www.freeswitch.org
> > http://wiki.freeswitch.org
> > http://www.cluecon.com
> >
> > FreeSWITCH-users mailing list
> > FreeSWITCH-users at lists.freeswitch.org
> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-
> > users
> > http://www.freeswitch.org
> >
> > ______________________________________________________________________
> > ___
> > Professional FreeSWITCH Consulting Services:
> > consulting at freeswitch.org
> > http://www.freeswitchsolutions.com
> >
> > 
> > 
> >
> > Official FreeSWITCH Sites
> > http://www.freeswitch.org
> > http://wiki.freeswitch.org
> > http://www.cluecon.com
> >
> > FreeSWITCH-users mailing list
> > FreeSWITCH-users at lists.freeswitch.org
> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-
> > users
> > http://www.freeswitch.org
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120207/f7c7d496/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list