Macros not working?


#1

Can anyone tell me why this doesnt works :

[macro-softphone]
exten => s,1,Dial(${ARG1})
exten => s,2,Voicemail,u${MACRO_EXTEN}
exten => s,4,Hangup
exten => s,102,Voicemail,b${MACRO_EXTEN}
exten => s,103,Hangup

[default]
exten => 1334,1,Macro(softphone, IAX2/idefisk)
exten => 1335,1,Macro(softphone, SIP/kphone)
exten => 1336,1,Macro(softphone, SIP/xlite)

BUT THIS DOES WORK :

[default]
exten => 1334,1,Dial(IAX2/idefisk)
exten => 1335,1,Dial(SIP/kphone)
exten => 1336,1,Dial(SIP/xlite)

When I use the second [default] secton, Im able to dial from one softphone to another. If I use the macros, I always go to mailbox (for the right extension
:smiling_imp: ) but without dialing !!!
This is what I get in the console :

– Executing Macro(“SIP/xlite-5e2b”, “softphone| IAX2/idefisk”) in new stack
– Executing Dial(“SIP/xlite-5e2b”, " IAX2/idefisk|5") in new stack
Oct 23 02:24:18 WARNING[10050]: channel.c:2206 ast_request: No channel type registered for ’ IAX2’
Oct 23 02:24:18 NOTICE[10050]: app_dial.c:1091 dial_exec_full: Unable to create channel of type ’ IAX2’ (cause 66 - Channel not implemented)
== Everyone is busy/congested at this time (1:0/0/1)
– Executing VoiceMail(“SIP/xlite-5e2b”, “u1334”) in new stack

Are there some restrictions about the macros usage that I should know :question:
Am I doing something bad ??

Any help is welcome :open_mouth:


#2

Macro looks fine, and based on the error on CLI it would appear that IAX2/idefisk is not registered at the time you make the call with the macro.

Could you post when it works directly and when it doesn’t?


#3

Sure. Thanks for your help

This is what I get when I call ext 1335, and kphone rejects the calls. All works fine, without macros.

– Executing Dial(“SIP/xpro-e1fb”, “SIP/kphone”) in new stack
– Called kphone
– SIP/kphone-18a7 is ringing
– Got SIP response 603 “Decline” back from 10.0.0.1
– SIP/kphone-18a7 is busy
== Everyone is busy/congested at this time (1:1/0/0)
– Executing VoiceMail(“SIP/xpro-e1fb”, “u1335”) in new stack

And whis is exactly the same situation, but using the macro. Both asterisk and clients where restarted :

Asterisk Ready.
– Registered SIP ‘kphone’ at 10.0.0.1 port 5062 expires 900
– Registered SIP ‘xpro’ at 10.0.0.2 port 8286 expires 1800
– Executing Macro(“SIP/xpro-71da”, “softphone| SIP/kphone”) in new stack
– Executing Dial(“SIP/xpro-71da”, " SIP/kphone") in new stack
Oct 23 10:49:17 WARNING[4231]: channel.c:2206 ast_request: No channel type registered for ’ SIP’
Oct 23 10:49:17 NOTICE[4231]: app_dial.c:1091 dial_exec_full: Unable to create channel of type ’ SIP’ (cause 66 - Channel not implemented)
== Everyone is busy/congested at this time (1:0/0/1)
– Executing VoiceMail(“SIP/xpro-71da”, “u1335”) in new stack

This is really rare. Why do I get a “Channel not implemented” message :question:
As I see it, the Dial command is not returning an “unreachable” status, but is returning with failure of allocate a SIP channel. how is this possible ??


#4

Buddy, you are not gonna believe it

After reading a lot in the asterisk wiki I finally found a clue, and solve the problem

Guess what :question:
the bug was the space before the extension argument when calling the macro . :open_mouth: The Asterisk Wiki ( voip-info.org/wiki/view/Asterisk+cmd+Dial ) says the Dial application wont work if we put spaces around its arguments :smiley:

I think Ill never forget this tip

Thanks for your attention

Juan