Hello,
I am not sure whether this was correct solution, but I overcommed the
issue by defining context [gosub-stdexten] and including the same
definition of dialplan
exten => xx,1,Dial(PJSIP/xx,30,TtrKk)
exten => xy,1,GoSub(gosub-stdexten,s,1(xy,PJSIP/xy,30,TtrKk))
in it.
It seems the procedure runs in its own context gosub-stdexten. If you
are aware of any better solution I would be glad to here about.
Marek
2021-01-05 18:32 GMT+01:00, Marek Greško <mgresko8 at
gmail.com>:> Hello,
>
> I am unable to figure out why I am not able to blind transfer when I
> am the caller and I call the extension defined by gosub.
>
> When running asterisk -rvvv I can see:
>
> -- Channel PJSIP/<caller number>-00000009: Dialed
'<transfer
> number>@gosub-stdexten' does not exist.
>
> It is evident there has been added some weird context after the
> extension number. The gosub-stdexten is a name of Gosub Procedure. Why
> it used it as a context? Where is the context name read from?
>
> The extensions are defined as follows:
> exten => xx,1,Dial(PJSIP/xx,30,TtrKk)
> exten => xy,1,GoSub(gosub-stdexten,s,1(xy,PJSIP/xy,30,TtrKk))
>
> xx is a caller, xy is a callee
>
> The procedure gosub-stdexten itself looks like this:
>
>
> [gosub-stdexten]
> ;
> ; Standard extension macro:
> ; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
> ; ${ARG2} - Device(s) to ring
> ; ${ARG3} - How long
> ; ${ARG4} - Options
> ; Retrieve the Call Forward number if available.
> exten => s,1,Set(CFIM=${DB(CFIM/${ARG1})})
> ;
> ; Dial the appropriate number depending on whether the Call Forward
> exten => s,n,GotoIf($["${vmbox}"!=""]?s-NoCFIM,1)
> exten => s,n,Set(_vmbox=${ARG1})
> exten =>
s,n,GotoIf($["${CFIM}"!=""]?s-CFIM,1:s-NoCFIM,1)
> ;
> ; Pass call to VoiceMail with the appropriate greeting.
> ;exten => s,n,GosubIf($[${DIALSTATUS}=BUSY]?s-BUSY,1:s-NOANSWER,1)
> ; Hangup.
> exten => s,n,Hangup()
> ;
> ; Dial Call Forward number & return.
> exten => s-CFIM,1,Dial(Local/${CFIM}@,${ARG3},${ARG4})
> exten => s-CFIM,n,GosubIf($[${DIALSTATUS}=BUSY]?s-BUSY,1:s-NOANSWER,1)
> exten => s-CFIM,n,Hangup()
> ; Dial actual extension & return.
> exten => s-NoCFIM,1,Dial(${ARG2},${ARG3},${ARG4})
> exten => s-NoCFIM,n,GosubIf($[${DIALSTATUS}=BUSY]?s-BUSY,1:s-NOANSWER,1)
> exten => s-NoCFIM,n,Hangup()
> ;
> ; Unavailable voicemail message if there is no answer.
> exten => s-NOANSWER,1,GotoIf($["${vmbox}"=""]?3:2)
> exten => s-NOANSWER,2,VoiceMail(${vmbox}@|u)
> exten => s-NOANSWER,3,Return()
> ; Busy voicemail message for any DIALSTATUS other than NOANSWER (or
> ANSWER).
> exten => s-BUSY,1,GotoIf($["${vmbox}"=""]?3:2)
> exten => s-BUSY,2,VoiceMail(${vmbox}@|b)
> exten => s-BUSY,3,Return()
>
>
> How could I fix it? Should I forward the original context somehow into the
> exten => s-NoCFIM,1,Dial(${ARG2},${ARG3},${ARG4})
> ? And also maybe here
> exten => s-CFIM,1,Dial(Local/${CFIM}@,${ARG3},${ARG4})
> ?
>
> Thanks
>
> Marek
>