API Call Diversions DND UPDA apply_changes

For the last year and half, via so far three support ticketing systems, I have reported that the API call of UPDA /tenants/{id}/apply_changes does not work. Or, at least it doesn’t appear to do anything. See VitalPBX

I have been told it’ll be addressed. I have seen literally over half a dozen updates come and go. I have even offered direct payments, actual real life currency, to have it fixed, but informed in so many words we don’t want your money. Despite the fact I shouldn’t have to pay for something that should already be working as advertised. I digress…

This API call is necessary for when updates are made to VitalPBX not via their GUI but via direct database changes - we’ve written our own API to interact with VitalPBX due to the severe lack of API features or usability. In our environment, we give our users the ability to do simple altering of PBX settings in our own GUI. Our GUI interacts with several PBXes, not just VitalPBX. Prime examples of this would be quick and easy call forwarding, fast single-click DND, changing of voicemail PINs, and such. These options have not been available via the VitalPBX API. There are no conventions for doing what is arguably, I think, one of the most important and valuable things a user would use an API call for, and that is Call Diversions.

No, using the VitalPBX GUI is not an option. As stated, we have our own. We use many PBXes for many scenario of customers.

It appears that the whole purpose and point of the apply_changes API call is to do exactly what I want. Apply the changes. It doesn’t work. It hasn’t ever worked. I will even take actual API calls directly for Call Diversions so I don’t need the “apply_changes” call. Can’t really believe those wouldn’t already exist. Again, I digress…

So this is a shout out to others in the VitalPBX world to hear your voice. I can’t possibly be the only one on the planet that needs or wants this. You may not even know you need it, but I will say this… 3CX can do it. RingCentral can do it. Nextiva can do it. Broadsoft can do it. Bicom Systems can do it. Simple API calls for simple call diversions. Help me out. Help me get the attention of “that guy” at VitalPBX who will get this done. I’m at my last hurrah here before seriously moving seats onto another platform. I think a year and a half and accompanying false promises is enough. This forum is now my bullhorn. Help me get their attention please.

It does seem to be working for me just fine!

[root@core1 ~]# curl --location -g --request UPDATE 'http://<redacted>/api/v2/tenants/1/apply_changes' --header 'app-key: <redacted>'
{"status":"success","message":"All the changes has been successfully applied on tenant vitalpbx","data":[]}

Or in postman:

curl --location --request UPDATE 'http://<redacted>/api/v2/tenants/1/apply_changes' \
--header 'app-key: <redacted>'

    "status": "success",

    "message": "All the changes has been successfully applied on tenant vitalpbx",

    "data": []


There’s a big difference between an API response and actually doing anything. Monkeys can program a JSON response. The apply_changes call is supposed to update the applicable underlying Asterisk configuration. The equivalent of clicking the red spinner in the VitalPBX GUI. It does not.

It is in fact doing exactly what it is supposed to do.

root@core1 ~]# asterisk -x"dialplan show this-is-a-test"
There is no existence of 'this-is-a-test' context
Command 'dialplan show this-is-a-test' failed.
[root@core1 ~]# echo "[this-is-a-test] \nexten => s,1,Noop" >> /etc/asterisk/vitalpbx/extensions__90-1-custom.conf
[root@core1 ~]# asterisk -x"dialplan show this-is-a-test"
There is no existence of 'this-is-a-test' context
Command 'dialplan show this-is-a-test' failed.
[root@core1 ~]# curl --location -g --request UPDATE 'http://<redacted>/api/v2/tenants/1/apply_changes' --header 'app-key: <redacted>'
{"status":"success","message":"All the changes has been successfully applied on tenant vitalpbx","data":[]}[root@core1 ~]#
[root@core1 ~]# asterisk -x"dialplan show this-is-a-test"
[ Context 'this-is-a-test' created by 'pbx_config' ]

-= 0 extensions (0 priorities) in 1 context. =-
[root@core1 ~]#

It does not update Asterisk configs as they relate to Call Diversions, or Voicemail PINS (AS DENOTED IN MY OP!), among others.

This is an issue that has been acknowleged and in the works with VitalPBX for a year and half. I want others to want this feature to work to hopefully entice them to address it (squeeky wheel gets the grease), not YOU chiming in seemingly just to muddy the waters. If you don’t want it and don’t use it, butt out! This topic is not for you.

Here you said, that the API doesn’t do anything, so I showed you that it does work.

Here you argued again that the API doesn’t reload asterisk. I showed you how it does…

In your OP you stated that the API does not work as advertised and VitalPBX lacks basic features. You did NOT indicate whatsoever that the endpoint does indeed work, but not with your custom changes you do directly to the DB.
You also failed to mention that this post is a feature request to include DND and call diversion endpoints in the API, but rather, how your own GUI works with other PBX servers and not with VitalPBX.

As a side note, there’s a user portal included in VitalPBX which allows end users setting DND, FollowMe/call diversions & changing VM pin.

All I was trying to do, is help out. This was the impression I got from the post, that the API isn’t working…

So again, if you are looking for help, please post exactly what you are doing and we may be able to help you. Otherwise, if this is a feature request, please indicate so, so we don’t confuse this post as you are looking for help.

1 Like

You might be into semantic pissing contests. I am not. Buzz off will ya.

I am absolutely with @PitzKey on this.
You said “doesn’t appear to do anything”.
He was trying to show that it does work. It also works for me. It could be better but it does work.

Please explain exactly what does not work!
Actually what it does is a full Asterisk Dump among other things.

If you can not even really explain what is NOT working, how should we be able to help?
So would you please mind to do so?

When you say “Call Diversions” what do you mean exactly?
I change the FollowMe and CFI in the Database myself. Then do “Apply” API and everything works as it should.

As a sidenote: you are one of the most annoying and unfair people i have ever met. And i have not really met you, luckily :wink:
Maybe that’s why not even the support wants to help you and don’t care about your money? :relaxed:

1 Like

Guys, as a mod, it is my duty to ensure this forum is and always stays a welcoming and friendly forum.

It is unfortunate that OP found my input as an attack, it was absolutely not intended to be one.

So, please remember to act respectful to each other, and please refrain from calling other people (including the VitalPBX staff) names or characters.

Not pointing fingers: But if you think that your post contains comments that can be said in a more positive way, please edit it and do so.

Thank you!

Okay, this was actually useful to me. It got me thinking differently. The other stuff is nonsense. You guys want a buddy then go onto the facebook or something.

It appears that the most recent 3.1.1-1 did address the issue. Maybe even the update prior to that? VitalPBX addressed it by now simply doing a full config dump and reload, unlike before. That’s not exactly what I’m looking for, as we’ve been doing that anyways via the AMI. It also disrupts call audio while it does that. That is NOT what the VitalPBX GUI does when you, for example, click the DND tick for an extension. It is fast and non-disruptive. That action is doing something other than apply_changes, and that is what I’ve been looking for. That has been mentioned to support in the myriad of tickets (in different ticket systems no less) on the subject.

By the way, our “error” was in the timer for the curl call. Since VitalPBX changed it to do a full system reload, yeah, it now needed more time. Again, this should not be needed for a simple call diversion adjustment.

The “fix” in all of this is a series of API calls that do exactly what the diversions do in VitalPBX’s GUI.

This is how you came out of the gate, exclamation point and all. You want to enlighten me on how I’m to take that?

Even though mo10 did talk in passive agressive circles, he did offer some semblance of empathy and technical enlightenment. For that I am grateful.

REGARDLESS. This solution is still not in place and acceptible for any production environment. You can even argue that now the apply_changes call does not work as advertised in that while it requires a tenant ID, that doesn’t appear to matter anymore as it blows up the entire system, all tenants, thus the long delay and loss of audio during the interim.

We need non-call-disruptive API calls for Call Diversions and Voicemail PIN edits. Please. Pretty pretty please with cherries and whip cream on top for those who’s feelings got hurt.

“Apply Changes” API was not changed afaik.
And don’t worry: calls don’t get dropped. It’s not restarting asterisk.
Just test it while making a call.

As said: it’s not perfect but it works.

You can test again and offer changes needed.

I see what you are asking for but can not do much if not even the support wants to help you.
I have no idea what suggestions you made on tickets and how you talked to them.

Seems like you need to know what exactly is done in extension status on changing things.

Do the voicemail pins get saved on apply Changes API?

No, we’re seeing call audio “pause” for about 5 seconds. That’s just enough time for many folks to go through the “are you there? can you hear me now” process, hangup, cuss and call back.

This might be because the firewall gets reloaded as well?
Ping your server while you do Apply Changes API.

Yes it is the restarting of the firewall dropping the audio. Good find. Not like we can do anything about it though unless VitalPBX adds some flags or attributes to the apply_changes API call to ignore the firewall.

Folks let me reiterate that this is how debugging works. Someone, or many someones, report a problem. We put our collective heads together to find the solution. That was my “bullhorn”, squeeky wheel gets the grease reasoning for creating this post. I literally sat idly for months and months with next to zero participation from VitalPBX. Classic case of ignoring and ultimately shooting the messenger.

I’m not going to be VitalPBX’s messenger any more and get shot at every goddam time I report something. I’ve got other more pressing things to do such as run my businesses. If it fits it fits, if not so be it. We’ll work around it. Adios amigos!

The method to apply changes through the API doesn’t set up the firewall rules. The delay while dumping changes or the voice breakdown could be related to the system usage and hardware capacity. As it has been said multiple times, Asterisk is a multi-thread application which means that it doesn’t matter the number of cores in your PBX.

The cores and RAM can indeed be used for other processes or applications, but it is essential to know that Asterisk doesn’t take advantage of them. So if your PBX is being used for multiple customers or has high traffic, it is expected to lost audio or breaks communication while applying changes because Asterisk might get overload.

As being said by @mo10, the API dump all the settings of a tenant. This process includes the generation of the SQLite data on Asterisk that might be heavy depending on the amount of data to be created.

There’s an option in the PJSIP Settings that is supposed to help with audio disconnection; this option is “Allow Transports Reload” and has to be disabled after configuration the NAT settings.

See, why couldn’t you just answer like this a year ago? 6 months ago? 3 months ago? Yesterday? Making me traverse down every rabbit hole imaginable. So instead I had to go get a bullhorn and rant in a public forum. From Pitz’s exclamation points to mo’s “I don’t really know you but you suck” to your own “take your business elsewhere” I finally, FINALLY, get an explanation from the person that would know.

I don’t which to go with… Thanks! or Thanks?

By the way, I tested the firewall per mo10. Ran apply_changes that took about 30 seconds. 25 or so calls going on. 20% or so resources in use. Lost audio. Could literally see people hanging up and calling back in. I could almost hear them cussing at me. Turned the firewall off. Ran apply_changes again which only took about 5 seconds. No loss of audio. Did this routine three times to make certain. That’s why the firewall explanation made perfect sense. Throwing resources at it is only a few clicks and dollars. I will do that.

I’ve now thrown up to 8 cores and 32 gig at this thing and still getting audio dropping for 5 seconds or so with 50% CPU getting gobbled up and the whole process taking about 15 seconds. With the firewall off, no audio drops, only about 10% CPU consumption and the whole process taking only about 5 seconds.

If I go into the VitalPBX GUI to Firewall Settings and merely click Save, audio drops for about 5 seconds and the process takes about 10 seconds to complete.

Clearly apply_changes is doing something with the firewall.

I’ve tried changing several ports directly in the database, and after applying changes, the ports modifications were not applied to the IP tables. I’ve checked the source code several times, and there’s no chance that the firewall got reload when using the API.

Remember to consider the CPU speed. With large installations, something like 3 GHz to 4 GHz sounds adequate.

@intelesync, I’ll say it again. My intention was to help and provide assistance.
Please STOP making fun of people, calling people names or characters.
Not everyone speaks or writes English very well, and can sometimes be a little hard to come across. In fact, English is my third language…

Please read our responses with no feelings attached… We’re here to help you… Look at our records on this forum and in the old one.

When I tested the API, calls did not drop audio. I’d like to reproduce this - is there anyway you can provide us with the exact information you are doing?
Also, please provide us what/which changes you made and didn’t get applied when you reloaded