Dear All,
I am new to FreePBX and I have a big issue I can not resolve on my own. I created an “Custom Destination” and created an IVR for this destination. Everything is working fine but I have one big problem…
In the Variable “CURL_RESULT” I am fetching some informations which I am need in the “jitsiroom” macro. But that is not working.
What I am doing wrong?
Here is my full code, after that some more informations…
[Jitsi-Conference-Entry]
exten => s,1,Answer()
;Set the extension used for Jitsi
exten => s,2,Set(Jitsi=6338)
;set variable to prevent looping
exten => s,3,Set(Attempts=0)
exten => s,4,Set(Attempts=${MATH(${Attempts}+1,i)})
;Test for invalid entries. On 4th attempt go to error sub
exten => s,5,ExecIf($["${Attempts}" = "4"]?Gosub(Attempts-Error,s,1))
exten => s,6(begin),NooP()
;system listens for DTMF and sets variable "confid"
;10=MAX DIGITS, 10=timeout
exten => s,n,Read(confid,conf-getpin,10,,,10)
;If blank value, start over
exten => s,n,ExecIf($["${confid}"=""]?goto(Jitsi-Conference-Entry,s,4))
;CURL Jitsi API with meeting pin & retrieve meeting name as the result
exten => s,n,goto(passcode)
exten => s,n(passcode),Set(CURL_RESULT=${SHELL(curl --silent https://jitsi-api.jitsi.net/conferenceMapper?id=${confid} | sed -e 's/.*"conference":"\(.*\)@.*/\1/')})
exten => s,n,Verbose(0, ${CURL_RESULT});
;speeding this up for the password, but you could mirror the process above if you want the extra readout and verification...
;system listens for DTMF and sets variable "confpin"
;6=MAX DIGITS, 10=timeout
exten => s,n,Read(confpin,pls-enter-conf-password&vm-then-pound&vm-tocancel,6,,,10)
;pls-enter-conf-password
;User will be sent onto the conference whether confpin is blank or not
;Add SIP Headers based on caller's entries & CURL result
;Sets CDR "userfield" with the Conference ID
;CDR can now be used to track number of calls and durations associated to the Conference ID
exten => s,n,Set(CDR(userfield)=Jitsi:${CURL_RESULT})
;3 = seconds to ring , m = play music on hold , A = announcement for dialed channel, M = Macro after call connects
exten = s,n,Dial(PJSIP/${Jitsi},,b(jitsiroom^addheader^1))
exten => s,n,Verbose(0, Contacting ${Jitsi}... Status is ${DIALSTATUS} );
;Take actions based on dialstatus
exten => s,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?unknown)
exten => s,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?conf-busy)
exten => s,n,GotoIf($["${DIALSTATUS}" = "CANCEL"]?unknown)
exten => s,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?unknown)
exten => s,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?unknown)
exten => s,n,GotoIf($["${DIALSTATUS}" = "DONTCALL"]?unknown)
exten => s,n,GotoIf($["${DIALSTATUS}" = "TORTURE"]?unknown)
exten => s,n,GotoIf($["${DIALSTATUS}" = "INVALIDARGS"]?unknown)
;Hangup if condition is not matched (in the event a new dialstatus is added with an update
exten => s,n,Hangup()
;Jitsi is not reachable, play error message
;This is also a good place to send an SMS to your lead system admins
exten => s,n(unknown),playback(please-contact-tech-supt&vm-goodbye)
exten => s,n,Hangup()
;Initial attempt was ok, but Jitsi didn't pickup the call.
;It's likely that the host hasn't yet authenticated / started the meeting
;Indicate that we're waiting for the leader to join and keep trying
exten => s,n(conf-busy),Playback(conf-waitforleader)
;120 = seconds to ring , m = play music on hold , A = announcement for dialed channel, M = Macro after call connects
exten = s,n,Dial(PJSIP/${Jitsi},,b(jitsiroom^addheader^1))
exten => s,n,Hangup()
[Attempts-Error]
;system plays message and hangs up
exten => s,1,playback(sorry-youre-having-problems)
exten => s,n,playback(tt-monkeys)
;exten => s,n,playback(hangup-try-again)
exten => s,n,Hangup()
[jitsiroom]
exten = addheader,1,Set(PJSIP_HEADER(add,Jitsi-Conference-Room)=nureintest)
This part is working fine, but then always “nureintest” is added to the Header Variable “Jitsi-Conference-Room”.
If I configure it like this:
;exten = addheader,1,Set(PJSIP_HEADER(add,Jitsi-Conference-Room)=nureintest)
;exten = addheader,1,Set(PJSIP_HEADER(add,Jitsi-Conference-Room)=${CURL_RESULT})
then the Header “Jitsi-Conference-Room” is not set to the content of “CURL_RESULT” variable, it is empty.
Could anyone give me a tipp how to resolve this issue?