ERROR[11393]: pbx.c:1406 ast_func_write: Function $ not regi


#1

Hi All,

I just started working with Asteriks and compiled latest source 1.2.5 and Zaptel 1.2.4.
I had no error during compilation and I’m using a TDM400P card with slot1 FXS and slot2 FXO (connected to PSTN).

I added the asterisk add-ons and sounds with no problem and launched it with asterisk -vvvvvvvgc. Everything was still OK.

Then I tried to place a phone call over the pstn and got this error message:
ERROR[11393]: pbx.c:1406 ast_func_write: Function $ not registered

I noticed this is only happening when I’m dialing the number. When I’m using an extension it is working properly.

Thx

For information my configuration is the following:

  1. Zaptel.conf
    loadzone=fr
    defaultzone=fr
    fxoks=1
    fxsks=2

  2. Extension.conf
    [test]

exten => s,1,Wait(1)
exten => s,2,Answer()
exten => s,3,NoOp($(CALLERID))
exten => s,n,NoOp($(CALLERIDNUM))
exten => s,n,NoOp($(CALLERIDNAME))
exten => s,n,Wait(4)
exten => s,n,Palyback(tt-weasels)
exten => s,n,Voicemail(1111@vm-test)
exten => s,n,Wait(2)
exten => s,n,Playback(vm-goodbye)
exten => s,n,Wait(2)
exten => s,n,HangUp()

exten => _0ZXXXX.,1,Macro(dial,$(EXTEN))
exten => _0ZXXXX.,2,HangUp()

exten => 9090,1,MeetMe(9090)

exten => 1001,1,Dial(IAX2/stef)
exten => 1001,2,HangUp()

exten => 1111,1,Dial(Zap/g2/0033145042897)
exten => 1111,2,HangUp()

exten => 2222,1,Dial(Zap/2/0033145042800)
exten => 2222,2,HangUp()

exten => 3333,1,Dial(Zap/1)
exten => 3333,2,HangUp()

exten => i,1,Playback(invalid)
exten => i,2,Goto(s,1)

exten => t,1,Goto(s,1)

[macro-dial]
exten => s,1,Set(${ARG1}=${EXTEN})
exten => s,2,Dial(Zap/2/${ARG1})


#2

[quote=“spaquet”][macro-dial]
exten => s,1,Set(${ARG1}=${EXTEN})
exten => s,2,Dial(Zap/2/${ARG1})[/quote]Just try:

[macro-dial] exten => s,1,Dial(Zap/2/${ARG1})
Lonnie


#3

Juste a little bit better: it removed the error message but phone calls are still not completed.
I’m ending with the following message:

-- Starting simple switch on 'Zap/1-1' -- Executing Macro("Zap/1-1", "dial|$(EXTEN)") in new stack -- Executing Dial("Zap/1-1", "Zap/2/$(EXTEN)") in new stack -- Called 2/$(EXTEN) -- Zap/2-1 answered Zap/1-1 -- Attempting native bridge of Zap/1-1 and Zap/2-1 -- Hungup 'Zap/2-1' == Spawn extension (macro-dial, s, 1) exited non-zero on 'Zap/1-1' in macro 'dial' == Spawn extension (macro-dial, s, 1) exited non-zero on 'Zap/1-1' -- Hungup 'Zap/1-1'
Pretty strange since the number I’m calling are starting with a 0 ???


#4

are you using curly brackets “{}” or regular “()” ?? it makes a difference.


#5

Seems like I have to use {} for macro constants and arguments so I’m using {} only for parameters and () to define macro core.

I made the following changes to my extension.conf file:

  1. Changed the name of the macro from dial to dialout just to make sure the macro is not confugins the Dial command from Asterisk.

  2. I followed lonnie suggestion to remove the first line of the macro which is useless.

Now I am still able to place calls using 1111, 2222 and even to establish good calls with SIP and IAX2 phones, but when dialing directly a phone number (let’s say 0134584900) from the phone connected on Zap/1 or any other SIP phones I’m ending with the following error:

-- Starting simple switch on 'Zap/1-1' -- Executing Macro("Zap/1-1", "dialout|$(EXTEN)") in new stack Mar 6 11:48:31 WARNING[8545]: app_macro.c:151 macro_exec: Context 'macro-dialout' for macro 'dialout' lacks 's' extension, priority 1 -- Executing Hangup("Zap/1-1", "") in new stack == Spawn extension (default, 0632648792, 2) exited non-zero on 'Zap/1-1' -- Hungup 'Zap/1-1'

I don’t know what the lack ‘s’ means and did not found yet relevant information on that.


#6

Understood the error in my last post.
Just change 2 by 1… and now I got the following problem:

    -- Executing Macro("SIP/mysjphone-94ce", "dialout|$(EXTEN)") in new stack
    -- Executing Dial("SIP/mysjphone-94ce", "Zap/2/$(ARG1)") in new stack
    -- Called 2/$(ARG1)
    -- Zap/2-1 answered SIP/mysjphone-94ce

Looks like a variable substitution issue. Don’t see why the pone number I’m dialing does not appear in the macro…


#7

i’m not convinced you’re using the right brackets … post your extensions.conf again ??


#8

[quote]exten => _0ZXXXX.,1,Macro(dial,$(EXTEN))
[/quote]
should be changed to…

exten => _0ZXXXX.,1,Macro(dial,${EXTEN})

Lonnie


#9

Yes you’re right but even changed it still requires some other modifications.
I found out what was wrong, patched and now it’s working !!!
Thank you all. :smiley: