API Challenge

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

API Challenge

Postby TroyD » Tue Nov 07, 2017 4:54 pm

I currently am using a .net web application that pops in a webform. I am trying to simulate the same function on the API that our fronters use to transfer calls to their counterparts. Normal flow is as follows: Call gets dialed and passed to the fronter agent and the webform pops up with the information from our CRM system. They will do a "Park - Customer Dial" with the extension for the closing agent and announce the callee to the closer then after the fronter is finished he clicks "Leave 3 Way Call" and the callee is with the closer and the fronter is presented with a dispo screen. All good and works well. With the new webform I am basically setting the extension for the closer by allowing them to select their name in a dropdown and the value is stored for the phone_number component of the API. I then call the transfer_conference function and the callee gets parked, the fronter is connected to the closer and once done I have a button that is titled "Finish Call" that sends the "LEAVE_3WAY_CALL" api function and what happens is the callee and the closer are connected but the fronter is also still there and cannot drop and dispo the call without hanging up and re-logging into the session. So it seems that the buttons work as specified however when trying to replicate it with the API calls it will not drop the fronter and send him to his dispo screen. I am not at the latest version of astguiclient, however, since the dialer screen buttons work as designed I am wondering if I need to update the astguiclient codebase or is there something im missing in the API call.

In Summary (this works fine, just cant get the api to leave 3 way correctly):
1) Call is connected to agent, he clicks "park customer dial" then enters the closers extension (located on another asterisk box connected via sip trunk with the following dialplan:)
a) exten => _1XXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _1XXX,2,Dial(${csopbxtrunk}/${EXTEN},,tTor)
exten => _1XXX,3,Hangup
2) Fronter talks to closer and tells him who he is going to talk to, info etc.. (Cust is on park)
3) Fronter Clicks "Leave 3 Way Call" then is sent to dispo screen and dispos call. (THIS IS WHERE THE API DOES THE UNEXPECTED AND ALL PERSONS ARE STILL ON THE CALL RATHER THAN DROPPING THE FRONTER)
4) Closer is still on the line with the client and completes the call.

The API calls are like so in the following order:

1) 192.168.0.223/agc/api.php?source=DEVTEST&user=6666&pass=1234&agent_user=6666&function=transfer_conference&value=PARK_CUSTOMER_DIAL&phone_number=1100

Then when he is done talking to closer:

2) 192.168.0.223/agc/api.php?source=DEVTEST&user=6666&pass=1234&agent_user=6666&function=transfer_conference&value=LEAVE_3WAY_CALL

Fronter and closer and client are connected after #2 and no way for fronter agent to leave the call without just hanging up the dialer line and re-logging in..

Updated signature to reflect versions - 3 server cluster (DB,WEB,DIALER) VERSION: 2.12-575a
BUILD: 161113-0900 - Asterisk 11.25.1-vici

THE VB CODE FOR THE 2 CALLS TO THE API FUNCTIONS ARE AS FOLLOWS:

Private Sub TransferCall()
Dim client = New HttpClient

Dim request = WebRequest.CreateHttp("http://192.168.0.223/agc/api.php")
request.Credentials = CredentialCache.DefaultCredentials
request.UserAgent = "value"
request.Method = HttpMethod.Post.Method
request.ContentType = "application/x-www-form-urlencoded"

Dim params = New Dictionary(Of String, String)
params.Add("source", Session("CAMPAIGN"))
params.Add("user", "6666")
params.Add("pass", "1234")
params.Add("agent_user", Session("FRONTER"))
params.Add("function", "transfer_conference")
params.Add("value", "PARK_CUSTOMER_DIAL")
params.Add("phone_number", cboCloser.SelectedValue)
'params.Add("consultave", "YES")

Dim stream = request.GetRequestStream()
Dim content = New FormUrlEncodedContent(params)
content.CopyToAsync(stream)


Dim result = request.GetResponseAsync().Result

Console.WriteLine(result.ToString)

End Sub

************************************************************

Private Sub Drop3Way()
Dim client = New HttpClient

Dim request = WebRequest.CreateHttp("http://192.168.0.223/agc/api.php")
request.Credentials = CredentialCache.DefaultCredentials
request.UserAgent = "value"
request.Method = HttpMethod.Post.Method
request.ContentType = "application/x-www-form-urlencoded"

Dim params = New Dictionary(Of String, String)
params.Add("source", Session("CAMPAIGN"))
params.Add("user", "6666")
params.Add("pass", "1234")
params.Add("agent_user", Session("FRONTER"))
params.Add("function", "transfer_conference")
params.Add("value", "LEAVE_3WAY_CALL")

Dim stream = request.GetRequestStream()
Dim content = New FormUrlEncodedContent(params)
content.CopyToAsync(stream)

Dim result = request.GetResponseAsync().Result

Console.WriteLine(result.ToString)

End Sub



Any pointers would be helpful, thanks in advance.
Last edited by TroyD on Fri Nov 10, 2017 12:18 pm, edited 1 time in total.
|3 Server - Cluster - WEB/DB/DIALER - ViciBox Install
|ASTERISK VER - Asterisk 11.25.1-vici
|AstGuiClient VERSION: 2.14-678a
|BUILD: 180613-0943
TroyD
 
Posts: 96
Joined: Fri Nov 02, 2007 4:03 pm

Re: API Challenge

Postby covarrubiasgg » Wed Nov 08, 2017 3:47 pm

I had a similar issue with an API function (LEAD_SEARCH) not working while the LEAD_SEARCH button from the agent interface was working perfect, i was recommended to upgrade to newest build (which was a bit newer than yours) i haven't had an maintenance windows yet, so i can't tell you if that fixes the problem.
covarrubiasgg
 
Posts: 420
Joined: Thu Jun 10, 2010 10:20 am
Location: Tijuana, Mexico

Re: API Challenge

Postby TroyD » Wed Nov 08, 2017 6:06 pm

covarrubiasgg wrote:I had a similar issue with an API function (LEAD_SEARCH) not working while the LEAD_SEARCH button from the agent interface was working perfect, i was recommended to upgrade to newest build (which was a bit newer than yours) i haven't had an maintenance windows yet, so i can't tell you if that fixes the problem.


Thanks, Ive looked at the api.php code more in depth but am hesitant since the agent screen works fine. (however it would seems that the agent interface screen does not utilize the API, im assuming it just does what the api is doing in the code behind as there are no logs in the api log in mysql unless I call the API directly from my VB functions.)

Thanks for the insight, right now it is the last piece in a puzzle keeping us from moving forward, would be interested how you make out on your next maint window.
|3 Server - Cluster - WEB/DB/DIALER - ViciBox Install
|ASTERISK VER - Asterisk 11.25.1-vici
|AstGuiClient VERSION: 2.14-678a
|BUILD: 180613-0943
TroyD
 
Posts: 96
Joined: Fri Nov 02, 2007 4:03 pm

Re: API Challenge

Postby TroyD » Fri Nov 10, 2017 2:41 pm

Update - Rather than sending the call from the fronter to the closer over the trunk to the other PBX, i am sending to the closers extension on the vicidial system. (they have 2 line appearances, one from the seperate pbx that vici is trunked to and their vici extension directly) This works for us. So it would appear that if the xfer number is an external number the leave_3way_call may not function as expected from the API. if it is an ingroup or internal extension it seems to be ok.
|3 Server - Cluster - WEB/DB/DIALER - ViciBox Install
|ASTERISK VER - Asterisk 11.25.1-vici
|AstGuiClient VERSION: 2.14-678a
|BUILD: 180613-0943
TroyD
 
Posts: 96
Joined: Fri Nov 02, 2007 4:03 pm

Re: API Challenge

Postby mflorell » Wed Jun 27, 2018 7:26 am

Asterisk CLI output?(with agi output set to BOTH)
API Log Report Output for this request?
Agent Screen Debug Logging enabled?
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida


Return to Support

Who is online

Users browsing this forum: Google [Bot] and 77 guests