• V20: 3CX Re-engineered. Get V20 for increased security, better call management, a new admin console and Windows softphone. Learn More.

Call Flow Designer , send http "get" on pickup/hangup

Status
Not open for further replies.

Romain

Joined
Sep 17, 2018
Messages
11
Reaction score
0
Hello all,

i'm succesfuly send http request "get" on a received call with the 3cx call flow designer.

I would like to send "http request" on pickup call and hangup ... i dont really know how to build this.Because actually i send my http request , then i transfer my call to the queue.So i Dont know how to check call status...

Thank you.
 
As Ernesto mentioned, once the call leaves the CFD via a transfer you loose visibility in the CFD of what happened to the call. You could handle making these HTTP requests with a 3CX Phone for Windows plugin, but that seems like a lot of work and future support. If you want to record when a call is answered or disconnected, I would create a service that monitors your calls using the 3CX Call Control API, and have the server side service execute these functions for you.
 
Thanks for your reply,

I started to used the 3cxphone api ,and with the 3cx Client it works , but here some bugs/problems maybe you can help me.

On my 3CX Client on Windows :
when "callInfo.State == CallState.Connected" sometime it's send 2 webrequests.

On my Desk Phone :
The "callInfo.State == CallState.Ended" doesnt work :( is it normal ?

Kind regards.
 
Another question, how can i just get the internal number of my phone who hangup?

I check documentation api but cant find the parameter...
 
Hello @Romain,

On my 3CX Client on Windows :
when "callInfo.State == CallState.Connected" sometime it's send 2 webrequests.
If you use 3CXPhone in CTI mode, this is something that might happen. This is due to the way calls are managed in that case. If this is your case, you will need to implement some filtering technique, like saving the CallID is some list, so when you receive the second notification you know that you already notified it, and then you ignore it...

On my Desk Phone :
The "callInfo.State == CallState.Ended" doesnt work :( is it normal ?
It should work. Our client side plugins rely on this...

Another question, how can i just get the internal number of my phone who hangup?
Please check this:
https://www.3cx.com/community/threads/account-id-or-credentials-id.55204/#post-228165


As Matthew mentioned, maybe it's easier if you create a program using the 3CX Call Control API for this.

Kind regards.
 
Thank you Ernesto.

yep i have a look with the 3CX Call Control API , but so hard for me to dev this one.
I prefer to use the 3CX plugin api. And it work perfectly !

and for my bug , i just noticed, when my 3cx client is in Deskphone(CTI) The "callInfo.State == CallState.Ended" works fine when i hangup with my desk phone.

But when i switch the 3cx client in "SoftPhone" , it wont work when i hangup...

Kind regards.
 
i have a last question, i would like to make http request only on inbound call.

I try to make if condition with the callinfo.State == CallStates.ringing but wont work. Any suggestion to have this filter?

Regards,

Romain
 
Please note that the enum value is:
CallState.Ringing

(the case is important)

Also, you have the property:
callStatus.Incoming

Which returns true if it's an inbound call, or false otherwise.
 
perfect ! thank you very much.
 
Hello @Romain,


If you use 3CXPhone in CTI mode, this is something that might happen. This is due to the way calls are managed in that case. If this is your case, you will need to implement some filtering technique, like saving the CallID is some list, so when you receive the second notification you know that you already notified it, and then you ignore it...
hello again Edossantos ,

Do you have any code example to implement CallID filtering... i dont really know how to play with CallID

regards,
 
Do you have any code example to implement CallID filtering... i dont really know how to play with CallID
If you use the "CRM Plugin Utils.dll" which is installed with 3CXPhone, you will have that logic already available. Please check any client side plugin, for example the code we provide for Outlook, which uses the AbsCallNotifier class to do this.
 
Well i check Outlook plugin and EBP plugin , but i didnt find method who ll filter CallID... in AbsCallNotifier class. Or probably because i dont understand how you use it ...
 
The AbsCallNotifier base class will do it for you. You don't need to copy the code. Just use that class in the same way the Outlook plugin does.
 
Well Well , i'm lost with this AbsCallNotifier class :(

My code is pretty easy for me atm , but im stuck to add this AbsCallNotifier class.
Here my newbie code :) , who works fine , i just need to stop the double notifications when the call is connected.

Code:
using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyPhonePlugins;
using System.Net;
using System.IO;
using System.Net.Http;


namespace PluginTest
{
    
    public class MyCRMPlugin
    {
        private static MyCRMPlugin instance = null;
        private IMyPhoneCallHandler callHandler;

        [MyPhonePlugins.CRMPluginInitializer]
        public static void Loader(MyPhonePlugins.IMyPhoneCallHandler callHandler)
        {
            instance = new MyCRMPlugin(callHandler);
        }



        public MyCRMPlugin(MyPhonePlugins.IMyPhoneCallHandler callHandler)
       {
            this.callHandler = callHandler;
            callHandler.OnCallStatusChanged += new MyPhonePlugins.CallInfoHandler(callHandler_OnCallStatusChanged);
            callHandler.OnMyPhoneStatusChanged += new MyPhonePlugins.MyPhoneStatusHandler(callHandler_OnMyPhoneStatusChanged);

        }

        private void callHandler_OnMyPhoneStatusChanged(object sender, MyPhonePlugins.MyPhoneStatus status)
        {
            
            

        }


        public void callHandler_OnCallStatusChanged(object sender, MyPhonePlugins.CallStatus callInfo)
        {

            bool incomingcall = callInfo.Incoming;

            
            if (incomingcall == true && callInfo.State == CallState.Connected)
            {
                    
                    
                    IExtensionInfo extensionInfo = sender as IExtensionInfo;
                    string called = extensionInfo.Number;
                    
                    string caller = callInfo.OtherPartyNumber;
                    
                    string url = "http://10.255.255.14/test/test.php?caller=" + caller + "&called=" + called + "";

                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                    Stream resStream = response.GetResponseStream();
                                    
            }

            
            if (incomingcall == true && callInfo.State == CallState.Ended)
            {         
                    
                    IExtensionInfo extensionInfo = sender as IExtensionInfo;
                    string called = extensionInfo.Number;
                    
                    string caller = callInfo.OtherPartyNumber;
                    
                    string url = "http://10.255.255.14/test/test.php?caller=" + caller + "&called=" + called + "";

                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                    Stream resStream = response.GetResponseStream();
              
            }
            
                      
        }

        public MyPhonePlugins.CallStatus MakeCall(String destination)
        {
            return callHandler.MakeCall(destination);
        }

    }
}
 
First, your class need to derive from AbsCallNotifier.
Code:
public class MyCRMPlugin : AbsCallNotifier

When you use the AbsCallNotifier you don't handle the callbacks directly. Instead, you pass the OnMyPhoneStatusChanged callback to AbsCallNotifier.onMyPhoneStatusChanged, and OnCallStatusChanged callback to AbsCallNotifier.onCallStatusChanged. And then you override 2 methods:
Code:
protected override ContactInfo onShowContact(string contactNumber, bool createIfNotFound)
{
  // Here you put the code to show the contact record (this will be invoked on ring or on answer depending on your configuration
}

Code:
protected override void onStoreCallInformation(CallInformation callInformation)
{
  // Here you put the code to execute when the call ends
}


If you prefer doing everything in your class, just replicating the technique used by the AbsCallNotifier class, then here is the code of that class so you can get some inspiration:
https://drive.google.com/file/d/13cpVQHrs9jnTcXI9zHq0sbnqLjwJZm8T/view?usp=sharing

Kind regards.
 
Status
Not open for further replies.

Getting Started - Admin

Latest Posts

Forum statistics

Threads
141,602
Messages
748,756
Members
144,714
Latest member
davide.luppi
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.