[asterisk-users] AMI API , Editing extensions.conf

Jose P. Espinal rakh at dangerclan.net
Wed Jan 14 16:25:08 CST 2009


Hello list,

I'm using a PHP script to communicate with asterisk via AMI, and edit 
configuration files. So far everything went ok, but I came up with a 
little problem editing extensions.conf using 'updateconfig'.


Is it possible to edit an existing line in extensions.conf file?, e.g.

Given a 'category' in my extensions.conf as follow:

[macro-mytest]
exten => s,1,Dial(${SYSTEM_TECHS}/${ARG1}@${SYSTEM_SIP_PROVIDER},,kKtTwW)
exten => s,n,Hangup()


I send this request to Asterisk:

...
Action: UpdateConfig
SrcFilename: extensions.conf
DstFilename: /tmp/extensions.conf
Action-000000: Update
Cat-000000: macro-TPLtrunkcell
Var-000000: exten
Value-000000: >s,n,Dial(${SYSTEM_TECHZ}/${ARG1},,kKtTwW)
Match-000000: SYSTEM_TECH
...



After the request, which Asterisk execute successfully, the result is 
something like:

[macro-mytest]
exten => s,1,Dial(${SYSTEM_TECHS}/${ARG1}@${SYSTEM_SIP_PROVIDER},,kKtTwW)
exten => s,n,Hangup()
exten => s,n,Dial(${SYSTEM_TECHZ}/${ARG1},,kKtTwW)


Instead of :

[macro-mytest]
exten => s,1,Dial(${SYSTEM_TECHZ}/${ARG1},,kKtTwW)
exten => s,n,Hangup()

... which was the answer I was specting.


I'm I forgetting something here?
(In the source I saw an extra parameter to AMI when using the 
UpdateConfig command, which was 'Line-XXXXXX', I tried indicating the 
exact line too, but that did not help).



Thanks for your help. Best regards,






--
Jose P. Espinal
http://blog.Slackware-Es.com



More information about the asterisk-users mailing list