Picture of Khalil 5054
Registered 4 years 322 days
Khalil 5054 Monday, 7 December 2020, 10:05 AM
rccapi calls
Hi

I currently have an api that uses the rccapi to make calls. I am currently using a waiting queue object to make these calls and experience a time delay when I want to call multiple people. In the class that makes the calls extended by AppPlatform\FinitStateAutomaton I return "ringt" when $msg->msg == 'r-alert', as I want to know if the person got called up. For each person it takes a bit under 10 seconds to return to the intial place where I make the api call.

1. As mentioned above I want to make multiple calls at the same time or with little to no time delay. Currently takes 3 minutes to call 17 people.
2. Is there a wait to limit the amount of time spent on each call without adjust the overall pbx settings. I.e. not going to voice mail which leads to longer delays?

Best regards,
Khalil
Andreas Fink
Moderator Registered 13 years 110 days
Andreas Fink (innovaphone) Monday, 7 December 2020, 10:33 AM
Re: rccapi calls
Hello Khalil,

we had some significant improvements on the RCC API in last weeks, so please try it with this development build:

http://download.innovaphone.com/ice/download/p/published/Firmware%20Version%2013r1/132670/


If no improvement is visible with the provided firmware, please create a log from WebSocket messages, and reproduce the problem.

If possible, log file entry should look like:

<datetime> <sent/recived websocket message>

Also please enable on the PBX Syslog option "PBX Calls".

On the Tracing, please enable "PBX".

Start a continuous trace, before reproduce the problem.

Attach the trace here as TXT-File.

Could you also describe the endpoints that are called? Usual IP-Phones?

Best Regards
Andreas Fink
Picture of Khalil 5054
Registered 4 years 322 days
Khalil 5054 Monday, 7 December 2020, 11:48 AM
Re: rccapi calls
Hi Andreas,

How do I update update the current firmware version?

Thanks for the quick response.

Sincerely,
Khalil
Picture of Khalil 5054
Registered 4 years 322 days
Khalil 5054 Monday, 7 December 2020, 12:03 PM in response to Andreas Fink (innovaphone)
Re: rccapi calls
The endpoints that are called are normal phone users, i.e. regular phones with simcards. Not sure if that answers the question.
Andreas Fink
Moderator Registered 13 years 110 days
Andreas Fink (innovaphone) Monday, 7 December 2020, 12:15 PM in response to Khalil 5054
1 of 1 users consider this post helpful
Re: rccapi calls
Khalil,

more thoughts on your problem:

First of all, your procedure to make a call seems to be a blocking operation. If you use the PHP example for WebSocket, there is a way to do such operations without blocking the thread - you just send a WebSocket message one by one, and do not wait for responses. Also you have to define handling for responses in an own function. This way you can fire up many calls at once.

If you call mobile phones, it takes some time to set up the call and get alerting message (your call must be signalled via PSTN to a mobile phone), so 10 seconds are usual time until r-alert is received.

To update the firmware of an innovaphone gateway you go to Maintenance/Upload/Firmware, upload a suitable BIN file for your box and reboot.

Best Regards
Andreas Fink
Picture of Khalil 5054
Registered 4 years 322 days
Khalil 5054 Monday, 7 December 2020, 12:43 PM
Re: rccapi calls
Thanks, this is what I was looking for, I will try to update the firmware as well smile do you have an example on this?

I think I understood how but I would really be helpful for me with an example, here is how I currently do it:

Screenshot_2020-12-07_at_12.42.01.png

Andreas Fink
Moderator Registered 13 years 110 days
Andreas Fink (innovaphone) Monday, 7 December 2020, 12:54 PM
1 of 1 users consider this post helpful
Re: rccapi calls
The line with "UserCall" starts just one call by sending a message. You could send multiple messages here.
Picture of Khalil 5054
Registered 4 years 322 days
Khalil 5054 Monday, 7 December 2020, 01:45 PM
Re: rccapi calls
Thanks again, is it correct to check for r-alert like shown. Without having the r-alert result functions or waiting for response I still get a 10 second time delay for calling one person. How do I not wait for response after making the call?
Andreas Fink
Moderator Registered 13 years 110 days
Andreas Fink (innovaphone) Monday, 7 December 2020, 04:40 PM
Re: rccapi calls
Oh, I just noticed the return "ringt" line. This is not how it should be used.

The FinitStateAutomation class implements state machine pattern (https://en.wikipedia.org/wiki/Finite-state_machine , https://en.wikipedia.org/wiki/State_pattern).

You can switch between the different states by returning the next state as string value. In your case you switch to the new state "ringt".

The machine starts with the state "Initial" when message "Start" sent to the state machine. This message will invoke the function ReceivedInitialStart.

When you return "ringt", you switch the state from "Initial" to "ringt". After this you have to define functions in this state, like ReceivedringtUserCallResult.

This functions are invoked asynchronous, when a message arrives on WebSocket. This way you can just send UserCall multiple times to different destinations, there is no need to wait for anything.

Best Regards
Andreas Fink


Picture of Khalil 5054
Registered 4 years 322 days
Khalil 5054 Monday, 7 December 2020, 05:25 PM
Re: rccapi calls
Oh, ok, the reason why I did it like that was because I was able to do this afterwards (ringt is called in norwegian xD):

$status = $rccapi->state->getName();

if($status == "ringt"){
return true;
}

$rccapi being the object making the calls. My objective was to notify that the call had been made from inside the class so I could log whether the call went through even though it always does I just wanted to return a receipt of some sort.
Picture of Christoph Künkel (innovaphone)
Moderator Registered 15 years 190 days
Christoph Künkel (innovaphone) Monday, 7 December 2020, 05:34 PM
Re: rccapi calls
a more obvious way to return status information would be to have a member variable indicating success and final call state. Once the automaton terminates, the calling code could inspect this member.

I understand that you want to call a list of called parties. Why don't you instantiate your derived class with a list of destinations? You would then send UserCall messages for each of the destinations in one bunch (quasi-concurrently).

Then, you collect all the responses coming in until all of your calls either went through to the "alert" state or to failure (busy etc.). When you received final status indications for all your destinations, you return "Dead" from the handling function (this indicates that your automaton terminates) so it returns to the caller.

Christoph
Picture of Khalil 5054
Registered 4 years 322 days
Khalil 5054 Monday, 7 December 2020, 06:34 PM
Re: rccapi calls
Ok now I remade the class to be able to send multiple usercalls, see attachement.

Im not sure how I would collect the responses coming in though. Maybe count the amount of times I receive r-alert until I reach the amount of length of array containing the numbers called? Sorry for the questions and the hard coded stuff, its just I am both new to php and innovaphone, I really appreciate that you guys take the time to answer me, it means a lot. Thank you smile

Also, what does it return to the caller when using "dead"?

Khalil

Screenshot_2020-12-07_at_18.22.11.png

Picture of Khalil 5054
Registered 4 years 322 days
Khalil 5054 Monday, 7 December 2020, 07:47 PM
Re: rccapi calls
Tried this out, didn't resolve the time delay, it still took the same amount of time as making a class and calling each number one at a time. It took about 20 seconds. If I am able to call multiple people and it only takes the same amount of time as calling one person in this case about 10 seconds i am happy...
Andreas Fink
Moderator Registered 13 years 110 days
Andreas Fink (innovaphone) Monday, 7 December 2020, 05:37 PM in response to Khalil 5054
Re: rccapi calls
This way you get a current state of the state machine. This is for sure not the way to communicate to outside the class.

You have to understand, that it an async function, that returns first, when you switch the state to "Dead."
Picture of Khalil 5054
Registered 4 years 322 days
Khalil 5054 Monday, 7 December 2020, 06:49 PM
Re: rccapi calls
It would be a lot easier to understand how one would want to communicate to outside the class if there were some sort of example doing so, or atleast for me. They way I have developed this is simply by asking on the forum, getting bits here and there, but also brute force guessing. I dont feel like I have a certain idea of how stuff is suppose to be done. This was initially the rccapi example, that I downloaded as you probably can see.
Picture of Khalil 5054
Registered 4 years 322 days
Khalil 5054 Monday, 7 December 2020, 12:54 PM in response to Andreas Fink (innovaphone)
Re: rccapi calls
Also another question, do I need to update the bootcode when updating the firmware? And if so where do I find the new version for bootcode?
Andreas Fink
Moderator Registered 13 years 110 days
Andreas Fink (innovaphone) Tuesday, 8 December 2020, 11:40 AM
Re: rccapi calls
No, need for it.
← You can define your color theme preference here