How do I use QueueLog's gosub?

I need the information of uniqueid and linkedid for calls entering the queue, and the only way to do this is through QueueLog. However, when I try to send it with gosub, the variables are not being passed. Can someone help me?

Here is the example of the extensions.conf.

[interno]
exten => *2000,1,Queue(testes,t,,,60,,,gosub-queuelog,s,1(testes,${CDR(uniqueid)}))

[gosub-queuelog]
exten => s,1,NoOp(ARG1: ${ARG1} | ARG2: ${ARG2} | ARG3: ${ARG3} | ARG4: ${ARG2} | CDR(uniqueid): ${CDR(uniqueid)} | CDR(linkedid): ${CDR(linkedid)})
 same => n,QueueLog(${ARG1},${ARG2},${CDR(src)},LINKEDID,${CDR(linkedid)})
 same => n,Return

Here is what happens in the console:

[2023-11-24 17:31:26]     -- Executing [*2000@ddd:1] Queue("PJSIP/7002-00000086", "testes,t,,,60,,,gosub-queuelog,s,1(testes,1700857886.919)") in new stack
[2023-11-24 17:31:28]     -- Executing [s@gosub-queuelog:1] NoOp("PJSIP/7022-00000087", "ARG1:  | ARG2:  | ARG3:  | ARG4:  | CDR(uniqueid): 1700857886.921 | CDR(linkedid): 1700857886.919") in new stack
[2023-11-24 17:31:28]     -- Executing [s@gosub-queuelog:2] QueueLog("PJSIP/7022-00000087", ",,7022,LINKEDID,1700857886.919") in new stack
[2023-11-24 17:31:28] WARNING[909335][C-0000003d]: app_queue.c:8387 ql_exec: QueueLog requires arguments (queuename,uniqueid,membername,event[,additionalinfo])
[2023-11-24 17:31:28]   == Spawn extension (gosub-queuelog, s, 2) exited non-zero on 'PJSIP/7022-00000087'
[2023-11-24 17:31:28] WARNING[909335][C-0000003d]: app_stack.c:1111 gosub_run: PJSIP/7022-00000087 Abnormal 'Gosub(gosub-queuelog,s,1)' exit.  Popping routine return locations.

What am I doing wrong?
Why aren’t the variables being read?

I tried to do it another way:

[interno]
exten => *2000,1,Queue(testes,b(gosub-queuelog,s,1(testes,${CDR(uniqueid)})t))


[gosub-queuelog]
exten => s,1,NoOp(ARG1: ${ARG1} | ARG2: ${ARG2} | ARG3: ${ARG3} | ARG4: ${ARG2} | CDR(uniqueid): ${CDR(uniqueid)} | CDR(linkedid): ${CDR(linkedid)} | GOSUB_RETVAL: ${GOSUB_RETVAL})
 same => n,QueueLog(${ARG1},${ARG2},${CDR(src)},LINKEDID,${CDR(linkedid)})
 same => n,Return()

This way, the variables are passed, but then it generates other problems.

There’s an error related to GOSUB_RETVAL that I have no idea what it’s about.

And another issue is that after the service is provided, the person who attended to it can no longer transfer the call.

[2023-11-28 18:11:52]     -- Executing [*2000@ddd:1] Queue("PJSIP/7002-0000013c", "testes,b(gosub-queuelog,s,1(testes,1701205912.2343)t)") in new stack
[2023-11-28 18:11:52]     -- Started music on hold, class 'default', on channel 'PJSIP/7002-0000013c'
[2023-11-28 18:11:52]     -- PJSIP/7050-0000013d Internal Gosub(gosub-queuelog,s,1(testes,1701205912.2343)t) start
[2023-11-28 18:11:52]     -- Executing [s@gosub-queuelog:1] NoOp("PJSIP/7050-0000013d", "ARG1: testes | ARG2: 1701205912.2343 | ARG3:  | ARG4: 1701205912.2343 | CDR(uniqueid): 1701205912.2345 | CDR(linkedid): 1701205912.2343 | GOSUB_RETVAL: ") in new stack
[2023-11-28 18:11:52]     -- Executing [s@gosub-queuelog:2] QueueLog("PJSIP/7050-0000013d", "testes,1701205912.2343,7050,LINKEDID,1701205912.2343") in new stack
[2023-11-28 18:11:52]     -- Executing [s@gosub-queuelog:3] Return("PJSIP/7050-0000013d", "") in new stack
[2023-11-28 18:11:52]   == Spawn extension (gosub-queuelog, s, 3) exited non-zero on 'PJSIP/7050-0000013d'
[2023-11-28 18:11:52]     -- PJSIP/7050-0000013d Internal Gosub(gosub-queuelog,s,1(testes,1701205912.2343)t) complete GOSUB_RETVAL=
[2023-11-28 18:11:52]     -- Called PJSIP/7050
[2023-11-28 18:11:52]   == Using SIP RTP Audio TOS bits 184
[2023-11-28 18:11:52]     -- PJSIP/7050-0000013d is ringing
[2023-11-28 18:11:55]     -- PJSIP/7050-0000013d answered PJSIP/7002-0000013c

This would be the best way, but I don’t know how to solve either of the two problems. The most critical one is that the attendant is no longer able to transfer the call.

Can someone help me?

I found the issue with transfers; the t had ended up inside the b.

Before:
exten => *2000,1,Queue(testes,b(gosub-queuelog,s,1(testes,${CDR(uniqueid)})t))

Now:
exten => *2000,1,Queue(testes,b(gosub-queuelog,s,1(testes,${CDR(uniqueid)}))t)

However, there’s still the problem with GOSUB_RETVAL.

[2023-11-28 18:49:32]     -- Executing [*2000@ddd:1] Queue("PJSIP/7002-00000148", "testes,b(gosub-queuelog,s,1(testes,1701208172.2427))t") in new stack
[2023-11-28 18:49:32]     -- Started music on hold, class 'default', on channel 'PJSIP/7002-00000148'
[2023-11-28 18:49:32]     -- PJSIP/7050-00000149 Internal Gosub(gosub-queuelog,s,1(testes,1701208172.2427)) start
[2023-11-28 18:49:32]     -- Executing [s@gosub-queuelog:1] NoOp("PJSIP/7050-00000149", "ARG1: testes | ARG2: 1701208172.2427 | ARG3:  | ARG4: 1701208172.2427 | CDR(uniqueid): 1701208172.2429 | CDR(linkedid): 1701208172.2427 | GOSUB_RETVAL: ") in new stack
[2023-11-28 18:49:32]     -- Executing [s@gosub-queuelog:2] QueueLog("PJSIP/7050-00000149", "testes,1701208172.2427,7050,LINKEDID,1701208172.2427") in new stack
[2023-11-28 18:49:32]     -- Executing [s@gosub-queuelog:3] Return("PJSIP/7050-00000149", "") in new stack
[2023-11-28 18:49:32]   == Spawn extension (gosub-queuelog, s, 3) exited non-zero on 'PJSIP/7050-00000149'
[2023-11-28 18:49:32]     -- PJSIP/7050-00000149 Internal Gosub(gosub-queuelog,s,1(testes,1701208172.2427)) complete GOSUB_RETVAL=
[2023-11-28 18:49:32]     -- Called PJSIP/7050
[2023-11-28 18:49:32]   == Using SIP RTP Audio TOS bits 184
[2023-11-28 18:49:32]     -- PJSIP/7050-00000149 is ringing

It doesn’t seem to be interfering, but… does anyone know what’s happening?

How can it be fixed?

There is nothing to fix. It’s just outputting the value of GOSUB_RETVAL, which is optional. It literally means the return value from Return() which since you haven’t specified any, there is none.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.