Umar Sear
2005-Mar-13 03:01 UTC
[Asterisk-Users] How can I eveluate trailing numbers in extensions.conf?
Checkout http://www.voip-info.org/wiki-Asterisk+variables I believe that should have the answer for you. furthermore assuming that your number is always going to be 12 digits. exten => _NXX.,1,SetVar(mynumber=${EXTEN:0:12}) - will give you your number. Hope this helps. Umar On Sun, 13 Mar 2005 09:25:11 +0100, Harald Milz <hm@seneca.muc.de> wrote:> Hi, > > this message seems to not have made it to the list the first time - sorry > if it did. > > My SIP provider includes trailing numbers to my account just fine, like > > ACK sip:sip@217.232.200.201 SIP/2.0 > Via: SIP/2.0/UDP 217.10.79.9;branch=z9hG4bKc62e.644d2d75.0 > From: "Anonymous" <sip:asterisk@217.10.66.71>;tag=as4b25d20f > Call-ID: 0a1400cf74e89e926fa6098c3ba5c874@217.10.66.71 > To: <sip:4986453424562@sipgate.net>;tag=as406f4254 > CSeq: 102 ACK > User-Agent: sipgate ser > Content-Length: 0 > > where 498645342456 is my SIP account phone number that can be reached from > the outside just fine. My question is, how can I evaluate the trailing "2" > in my extensions.conf? This would be ideal for direct dialing to an attached > phone, and not be restricted to a single digit. > > <asterisk-dev> The full number is included in the SIP message but does * keep it > somewhere internally so that one could maybe add another externally usable > * variable? I browsed the source code but could not find anything... TIA! > > Ciao, > hm > > -- > Today is the first day of the rest of the mess > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >
Abhishek Tiwari
2005-Mar-13 03:19 UTC
[Asterisk-Users] How can I eveluate trailing numbers in extensions.conf?
Hi, you can use StripMSD if you are sure of the number of dialled digits. or you can use {$EXTEN:-1:1}, where {$EXTEN:a:b} means first b digits starting from a, from the front or back depending whether a > 0 or a < 0. additionally, can have your own variables, just look at pbx_retrieve_variable in pbx.c -Abhishek Drishti Soft www.drishti-soft.com On Sun, 13 Mar 2005 10:01:27 +0000, Umar Sear <umarsear@gmail.com> wrote:> Checkout > > http://www.voip-info.org/wiki-Asterisk+variables > > I believe that should have the answer for you. > > furthermore assuming that your number is always going to be 12 digits. > > exten => _NXX.,1,SetVar(mynumber=${EXTEN:0:12}) - will give you your number. > > Hope this helps. > > Umar > > > On Sun, 13 Mar 2005 09:25:11 +0100, Harald Milz <hm@seneca.muc.de> wrote: > > Hi, > > > > this message seems to not have made it to the list the first time - sorry > > if it did. > > > > My SIP provider includes trailing numbers to my account just fine, like > > > > ACK sip:sip@217.232.200.201 SIP/2.0 > > Via: SIP/2.0/UDP 217.10.79.9;branch=z9hG4bKc62e.644d2d75.0 > > From: "Anonymous" <sip:asterisk@217.10.66.71>;tag=as4b25d20f > > Call-ID: 0a1400cf74e89e926fa6098c3ba5c874@217.10.66.71 > > To: <sip:4986453424562@sipgate.net>;tag=as406f4254 > > CSeq: 102 ACK > > User-Agent: sipgate ser > > Content-Length: 0 > > > > where 498645342456 is my SIP account phone number that can be reached from > > the outside just fine. My question is, how can I evaluate the trailing "2" > > in my extensions.conf? This would be ideal for direct dialing to an attached > > phone, and not be restricted to a single digit. > > > > <asterisk-dev> The full number is included in the SIP message but does * keep it > > somewhere internally so that one could maybe add another externally usable > > * variable? I browsed the source code but could not find anything... TIA! > > > > Ciao, > > hm > > > > -- > > Today is the first day of the rest of the mess > > _______________________________________________ > > Asterisk-Users mailing list > > Asterisk-Users@lists.digium.com > > http://lists.digium.com/mailman/listinfo/asterisk-users > > To UNSUBSCRIBE or update options visit: > > http://lists.digium.com/mailman/listinfo/asterisk-users > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >
Harald Milz
2005-Mar-13 05:54 UTC
[Asterisk-Users] How can I eveluate trailing numbers in extensions.conf?
Umar Sear <umarsear@gmail.com> wrote:> Checkout> http://www.voip-info.org/wiki-Asterisk+variables> I believe that should have the answer for you.> furthermore assuming that your number is always going to be 12 digits.> exten => _NXX.,1,SetVar(mynumber=${EXTEN:0:12}) - will give you your number.I'm not sure. I have register => NNNNNNN:XXXXXX@sipgate.de/sip in my sip.conf, and in extensions.conf, the "sip" extension knows nothing about the called number. [incoming] ; exten => sip,1,Goto(isdn,1${CALLEDNUM:-1},1) exten => sip,1,Goto(isdn,11,1) exten => sip,2,Voicemail(u100) exten => sip,102,Voicemail(b100) How do I set "register" properly to use a simple $EXTEN expression as above? I did try that before, no luck. (I have some more registrations in my sip.conf because I want to use a simple LCR strategy). In any case, I just posted a patch against the CVS to the asterisk-dev list. This patch gives you a new variable CALLEDNUM that does what I need. It's used as in the commented example above. -- Reality is for those who can't face Science Fiction.