Custom context in multi tenant

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.

I don’t have a license and was testing with community version with 1 tenant

Please read carefully and see what i wrote here:

Please update the Custom Context Addon!

It this does not help: starter license or rebranding module is cheap.

It did not work, receiving the same error, upgraded to custom context 3.0.1-3, broke the context in Gui and getting this error

I’ve tested on a brand new server hosted in D.O.

No error. I have no license on this server.

As you can see: he does not use a brand new server. It is hard to compare. No migration is going on on a new server.

The new version of each add-on executes migrations if needed. My guess is that the migrations were not executed for some reason.

Going to the console, and executing the command below will force the execution of the migrations.
/usr/share/vitalpbx/scripts/apply_migrations “custom-contexts”

Are you still on the community version?

Yes, still have n community version

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