I want to have a arbitary named variable within the client's user details in
sip.conf
[client1]
dialplan=NZ
..........
In extensions.conf (Logic expressed using PHP style)
if ($dialplan == NZ) {
$NAT = 0;
$INT = 00;
};
and in the [outgoing] section
; Australia
exten => _${INT}61[278]NXXXXXX.,1,Set(CDR(UserField)=AUSTRALIA)
exten => _${INT}61[278]NXXXXXX.,n,Dial(SIP/SIP_PROVIDER/0${EXTEN:4:9})
How can I implement this in Asterisk style?
Thanks,
Michael
Use setvar=variablename=value
Eg: under [client1]
setvar=dialplan=NZ
Then just reference ${dialplan} in your extensions.conf
Cheers
Andy
-->> -----Original Message-----
-->> From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-
-->> bounces at lists.digium.com] On Behalf Of Michael
-->> Sent: 15 December 2008 04:36
-->> To: asterisk-users at lists.digium.com
-->> Subject: [asterisk-users] Variables for dial plan
-->>
-->> I want to have a arbitary named variable within the client's
user
-->> details in
-->> sip.conf
-->>
-->> [client1]
-->> dialplan=NZ
-->> ..........
-->>
-->> In extensions.conf (Logic expressed using PHP style)
-->>
-->> if ($dialplan == NZ) {
-->> $NAT = 0;
-->> $INT = 00;
-->> };
-->>
-->> and in the [outgoing] section
-->>
-->> ; Australia
-->> exten => _${INT}61[278]NXXXXXX.,1,Set(CDR(UserField)=AUSTRALIA)
-->> exten =>
_${INT}61[278]NXXXXXX.,n,Dial(SIP/SIP_PROVIDER/0${EXTEN:4:9})
-->>
-->> How can I implement this in Asterisk style?
-->>
-->> Thanks,
-->>
-->> Michael
-->>
-->> _______________________________________________
-->> -- Bandwidth and Colocation Provided by http://www.api-digital.com
--
-->>
-->> asterisk-users mailing list
-->> To UNSUBSCRIBE or update options visit:
-->> http://lists.digium.com/mailman/listinfo/asterisk-users
On Mon, 15 Dec 2008 21:31:56 you wrote:> Use setvar=variablename=value > > Eg: under [client1] > setvar=dialplan=NZ > > Then just reference ${dialplan} in your extensions.conf > > Cheers > AndyThanks, now how do I achieve the following logic? if ($dialplan == NZ) { $NAT = 0; $INT = 00; }; Michael
One of these methods will work:
exten => s,n,ExecIf($["${dialplan}" =
"NZ"]|Set|NAT="0")
exten => s,n,ExecIf($["${dialplan}" =
"NZ"]|Set|INT="00")
-or-
exten => s,n,GotoIf($["${dialplan}" != "NZ"]?not-nz)
exten => s,n,Set(NAT="0")
exten => s,n,Set(INT="00")
exten => s,n(not-nz),more_dialplan_stuff
On Mon, Dec 15, 2008 at 3:26 AM, Michael <michael at networkstuff.co.nz>
wrote:> On Mon, 15 Dec 2008 21:31:56 you wrote:
>> Use setvar=variablename=value
>>
>> Eg: under [client1]
>> setvar=dialplan=NZ
>>
>> Then just reference ${dialplan} in your extensions.conf
>>
>> Cheers
>> Andy
>
> Thanks, now how do I achieve the following logic?
>
> if ($dialplan == NZ) {
> $NAT = 0;
> $INT = 00;
> };
>
> Michael
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>