Pb of Variable into a GOSUB

Hi,

I use Sub routine, which loose my number :

I explain : Somebody is dialin : 123456
Exten => 123456,1,gosub( aa,s,1) ---- ( I also tried : Exten => 123456,1,gosub( aa,s,1(${EXTEN}))
Exten => 123456,2,voicemail…

=========
[aa]
Exten => s,1,dial( SIP/${EXTEN}@bb)
Exten => s,2,return

in fact, the number sent is not : 123456 , “s” ???
If EXTEN is a global variable, that should be sent to the Subroutine ? no ?

Any idea how to keep the Number dial

Thanks

${EXTEN} is not really a variable; it is a read only function that reads the channel data structure field containing the current location in the dialplan.

You can either set a non-reserved variable, or use the technique in the sample configuration file, e.g. for stdextension.

Hi David55,

Not sure to see how to use stdextension macro ?? ( I had a look … some people have an /etc/asterisk/stdextension.conf ??? ( not me )

Do you think that I should declare a Global variable like : global=${EXTEN}
and to use ‘global’ into the Sub routine ???

stdextension is no longer a macro. There are examples in the sample extensions.conf file.

There is no need to use a global variable, as an ordinary, channel one will do.