Custom context in multi tenant

Thanks a lot, it worked, last question, If I have to add multiple context, can I change the name to anything from custom-contexts

[custom-contexts](+)

exten => cc-7,1,Noop()
 same => n,Gosub(email-notify-DM1,s,1(T5_cos-all,9003,1))

[email-notify-DM1]
exten=> _.,1,Set(user=admin)
same=>n,Set(Answer=${CURL(https://example.com/admin/client_data_received?client_id="${CALLERID(number)}"&token=adFki1234861252235fgh1))
same=>n,Goto(${ARG1},${ARG2},${ARG3})

No, VitalPBX is sending the calls to the extension in the custom-contexts context.

how can I use 2 seperate CC in sub tenant, only first one is working and second one gives this error :

LOG

Executing [app-incoming@sub-set-call-vars:1] NoOp("PJSIP/T5_51001-0000001d", "Incoming Call App CDR") in new stack
    -- Executing [app-incoming@sub-set-call-vars:2] GotoIf("PJSIP/T5_51001-0000001d", "0?:return") in new stack
    -- Goto (sub-set-call-vars,app-incoming,6)
    -- Executing [app-incoming@sub-set-call-vars:6] Return("PJSIP/T5_51001-0000001d", "") in new stack
    -- Executing [9005@T5_cos-all-post:2] NoOp("PJSIP/T5_51001-0000001d", "Custom Application: custom-contexts1") in new stack
    -- Executing [9005@T5_cos-all-post:3] Goto("PJSIP/T5_51001-0000001d", "custom-contexts,cc-11,1") in new stack
    -- Goto (custom-contexts,cc-11,1)
[2021-11-20 21:02:42] WARNING[9454][C-0000001e]: pbx.c:4510 __ast_pbx_run: Channel 'PJSIP/T5_51001-0000001d' sent to invalid extension but no invalid handler: context,exten,priority=custom-contexts,cc-11,1
[2021-11-20 21:02:54] ERROR[8638]: res_pjsip_outbound_authenticator_digest.c:450 digest_create_request_with_auth: Host: '145.239.255.24:5061': There were no auth ids available
[2021-11-20 21:03:24] ERROR[8638]: res_pjsip_outbound_authenticator_digest.c:450 digest_create_request_with_auth: Host: '145.239.255.24:5061': There were no auth ids available

[custom-contexts] (+)
exten => cc-10,1,Noop()
 same => n,Gosub(email-notify-DM,Sales-9003,1(T5_cos-all,9003,1))

[custom-contexts1]  (+)
exten => cc-11,1,Noop()
 same => n,Gosub(email-notify-DM,Sales-9004,1(T5_cos-all,9004,1))

This is what I tried to explain earlier. You keep them all under the same context.

[custom-contexts] (+)
exten => cc-10,1,Noop()
 same => n,Gosub(email-notify-DM,Sales-9003,1(T5_cos-all,9003,1))

exten => cc-11,1,Noop()
 same => n,Gosub(email-notify-DM,Sales-9004,1(T5_cos-all,9004,1))

Thanks for all your time, it worked on first attempt, as soon as I created a CC in main tenant, broken again, getting this error.

[custom-contexts] (+)
exten => cc-12,1,Noop()
 same => n,Gosub(email-notify-DM,Sales-9003,1(T5_cos-all,9003,1))

exten => cc-13,1,Noop()
 same => n,Gosub(email-notify-DM,Sales-9004,1(T5_cos-all,9004,1))

LOGS

   -- Executing [app-incoming@sub-set-call-vars:6] Return("PJSIP/T5_51001-0000003c", "") in new stack
    -- Executing [9001@T5_cos-all-post:2] NoOp("PJSIP/T5_51001-0000003c", "Custom Application: Tenant CC Test") in new stack
    -- Executing [9001@T5_cos-all-post:3] Goto("PJSIP/T5_51001-0000003c", "custom-contexts,cc-12,1") in new stack
    -- Goto (custom-contexts,cc-12,1)
    -- Executing [cc-12@custom-contexts:1] NoOp("PJSIP/T5_51001-0000003c", "Tenant CC Test") in new stack
    -- Executing [cc-12@custom-contexts:2] Gosub("PJSIP/T5_51001-0000003c", "custom-contexts,s,1(ext-queues,9003,1)") in new stack
[2021-11-21 01:45:05] ERROR[8551][C-0000003d]: app_stack.c:593 gosub_exec: Attempt to reach a non-existent destination for Gosub: (Context:custom-contexts, Extension:s, Priority:1)
  == Spawn extension (custom-contexts, cc-12, 2) exited non-zero on 'PJSIP/T5_51001-0000003c'

What does Tenant CC Test do? You seem to be sending it to a non existent destination.

This is just a name of custom application


What are you trying to achieve? You need to send it to your own custom context that actually exist…

From sub tenant T5

  1. Call custom application
  2. Invoke a HTTPS link
  3. Transfer to queue, T5 own queue
[custom-contexts] (+)
exten => cc-12,1,Noop()
 same => n,Gosub(email-notify-DM,Sales-9003,1(T5_cos-all,9003,1))

exten => cc-13,1,Noop()
 same => n,Gosub(email-notify-DM,Sales-9004,1(T5_cos-all,9004,1))

[email-notify-DM1]
exten=> _.,1,Set(user=admin)
same=>n,Set(Answer=${CURL(https://example.com/admin/client_data_received?client_id="${CALLERID(number)}"&token=adFki1234861252235fgh1))
same=>n,Goto(${ARG1},${ARG2},${ARG3})

What context name should I use from the GUI?

custom-contexts

Or

email-notify-DM

Again, the problem is that VitalPBX does not create the cc-XX extension when you are under a tenant. So all you need to do, is create it on your own like you did above.

I am sorry, I am not understanding, could you please give me an example how to achieve this?

Like how to create a custom context and where and how to create cc-xx extension etc

Here’s how a normal custom context would look in the GUI.

Description: Play Beep
Context: my-play-beep
Extension: s
Priority: 1

Destination: Queue > 1123

Now in your custom.conf file, you would have something like:

[my-play-beep]
exten => s,1,Noop(Playing a beep sound)
exten => s,n,Playback(beep)
exten => s,n,Goto(${ARG1},${ARG2},${ARG3})

That is all you need to do normally in order for things to work. The reason for that is, is because VitalPBX is generating the following dialplan:

[custom-contexts]

exten => cc-27,1,Noop(Play Beep)
 same => n,Gosub(my-play-beep,s,1(1123,cos-all,1)

So the bug that we are having trouble here is with the exten cc-27 not getting generated under tenants. So all you need to do is to create these extensions under the custom-contexts context in your custom.conf file.

So if you need to create multiple Custom Context entries in the GUI, you will need to add these cc-xx extensions in your custom.conf file.

this is exactly what I am doing , when I dial 9001 (custom app code), I am getting the error, even cc-16 is hard coded in my custom.conf file

My custom.conf file

[custom-contexts] (+)
exten => cc-16,1,Noop()
 same => n,Gosub(email-notify-DM-ST,Sales-9003,1(T5_cos-all,9003,1))

[email-notify-DM]
exten=> _.,1,Set(user=admin)
same=>n,Set(Answer=${CURL(https://example.com/admin/client_data_received?client_id="${CALLERID(number)}"&token=adFki1234861252235fgh1))
same=>n,Goto(${ARG1},${ARG2},${ARG3})

image

LOGS:

-- Executing [s@sub-local-dialing:5] Return("PJSIP/T5_51001-0000006c", "") in new stack
    -- Executing [s@T5_cos-all:12] GotoIf("PJSIP/T5_51001-0000006c", "0?end-call") in new stack
    -- Executing [s@T5_cos-all:13] Set("PJSIP/T5_51001-0000006c", "OUTBOUND_PROFILE=") in new stack
    -- Executing [s@T5_cos-all:14] GotoIf("PJSIP/T5_51001-0000006c", "1?post-dialing") in new stack
    -- Goto (T5_cos-all,s,16)
    -- Executing [s@T5_cos-all:16] Goto("PJSIP/T5_51001-0000006c", "T5_cos-all-post,9001,1") in new stack
    -- Goto (T5_cos-all-post,9001,1)
    -- Executing [9001@T5_cos-all-post:1] Gosub("PJSIP/T5_51001-0000006c", "sub-set-call-vars,app-incoming,1") in new stack
    -- Executing [app-incoming@sub-set-call-vars:1] NoOp("PJSIP/T5_51001-0000006c", "Incoming Call App CDR") in new stack
    -- Executing [app-incoming@sub-set-call-vars:2] GotoIf("PJSIP/T5_51001-0000006c", "0?:return") in new stack
    -- Goto (sub-set-call-vars,app-incoming,6)
    -- Executing [app-incoming@sub-set-call-vars:6] Return("PJSIP/T5_51001-0000006c", "") in new stack
    -- Executing [9001@T5_cos-all-post:2] NoOp("PJSIP/T5_51001-0000006c", "Custom Application: Tenant CC Test") in new stack
    -- Executing [9001@T5_cos-all-post:3] Goto("PJSIP/T5_51001-0000006c", "custom-contexts,cc-16,1") in new stack
    **-- Goto (custom-contexts,cc-16,1)**
    -- Executing [cc-16@custom-contexts:1] NoOp("PJSIP/T5_51001-0000006c", "custom-contexts") in new stack
    -- Executing [cc-16@custom-contexts:2] Gosub("PJSIP/T5_51001-0000006c", "custom-contexts,s,1(ext-queues,9003,1)") in new stack
[2021-11-21 22:45:10] ERROR[20241][C-0000006d]: app_stack.c:593 gosub_exec: Attempt to reach a non-existent destination for Gosub: (Context:custom-contexts, Extension:s, Priority:1)

It seems that cc-16 is already generated. Did you perhaps resubmit this Custom Context under the main tenant?

resubmit under MT, didn’t work.

I removed it from the tenant and created again and new number cc-17 generated, I updated my custom.conf with cc-17 and working now, but I am sure, if I create new context from the GUI in main tenant, it will break again, this is the issue. the only workaround is to re-create if broken and update cc-xx in the file.


[custom-contexts] (+)
exten => cc-17,1,Noop()
 same => n,Gosub(email-notify-DM,Sales-9003,1(T5_cos-all,9003,1))

@ARehman,

Checking with the team, I’ve been told that the Custom Contexts module is not Multi-Tenant capable. Nonetheless, we expect to introduce that capability in the next VitalPBX version.

1 Like

Thanks, is there any ETA to fix this in next release?

Please try the latest version. VitalPBX Phone System | Change Log

And then check if you have the latest Addon as well:

@ARehman please let us know if it is working as expected now.