serfreeman1337 / asterlink

Asterisk integration with Bitrix24 and SuiteCRM
MIT License
29 stars 18 forks source link

Call finished before hangup #7

Open FaGitt opened 3 years ago

FaGitt commented 3 years ago

First of all: The piece of work you did is awesome!!!

I'm using your software with asterisk 18 and AMI 7 The communication between SuiteCRM and asterlink is working, incomming and outgoing calls are beeing loged.

The problem begins with the updating of the created record. Here is the log:

msg="New incoming call" lid=1633609721.46 msg="map[asterlink_call_seconds_c:0 asterlink_cid_c:+1234567890 asterlink_did_c:987654321 asterlink_uid_c:1633609721.46 date_start:2021-10-07 12:28:41 direction:Inbound duration_hours:0 duration_minutes:0 name:+123456789 status:Planned]" method=POST suite=true url="http://URL/index.php?entryPoint=AsterLinkEntryPoint&action=create_call_record" msg="201 Created" method=POST suite=true url="http://URL/index.php?entryPoint=AsterLinkEntryPoint&action=create_call_record" msg="Call registred" id=a2d7359d-8d6d-7586-6e4b-615ee7708673 lid=1633609721.46 suite=true msg=Answer ext=21 lid=1633609721.46 msg="map[data:map[assigned_user_id:1] id:a2d7359d-8d6d-7586-6e4b-615ee7708673]" method=POST suite=true url="http://URL/index.php?entryPoint=AsterLinkEntryPoint&action=update_call_record" msg=Answer ext=21 lid=1633609721.46 msg="Call finished" lid=1633609721.46 msg="204 No Content" method=POST suite=true url="http://URL/index.php?entryPoint=AsterLinkEntryPoint&action=update_call_record" msg="map[data:map[assigned_user_id:1] id:a2d7359d-8d6d-7586-6e4b-615ee7708673]" method=POST suite=true url="http://URL/index.php?entryPoint=AsterLinkEntryPoint&action=update_call_record" msg="204 No Content" method=POST suite=true url="http://URL/index.php?entryPoint=AsterLinkEntryPoint&action=update_call_record" msg="map[data:map[asterlink_call_seconds_c:0 date_end:2021-10-07 12:28:51 duration_hours:0 duration_minutes:0 status:Held] id:a2d7359d-8d6d-7586-6e4b-615ee7708673]" method=POST suite=true url="http://URL/index.php?entryPoint=AsterLinkEntryPoint&action=update_call_record" msg="204 No Content" method=POST suite=true url="http://URL/index.php?entryPoint=AsterLinkEntryPoint&action=update_call_record"

Do you know how to get rid of this problem?

serfreeman1337 commented 3 years ago

Do you use FreePBX or have own dialplan ?

To troubleshoot this I will need AMI dump. Check "AMI events dump" instructions from this comment.

AMI dump can contain some private info, like CallerID and DID numbers. You can send it to my email.

FaGitt commented 2 years ago

Thanks for your fast response!

Here are the infos you need:

FW Console - Incredible PBX 2021 Utility 15.0.17.55

Asterisk 18.1.1

record.log

After the log I mentioned that follow me was active for extention 21, but there was no change to the behavior due to disabling it....

serfreeman1337 commented 2 years ago

I will look into follow me situation soon.

but there was no change to the behavior due to disabling it....

Can you record new ami dump, but with follow me disabled ?

UPD: looks like it picked up hangup events from local channel optimizations. Please remove macro-dial from ext_context in config and test again.

UPD2: Quick fix Add following highlighted lines to ami_connect.go around line 320:

case connect.In:
        /*if _, ok := ExtContext[e["Context"]]; !ok {
            return
        }*/

+        if e["Context"] == "macro-dial" && (e["DestChannel"][6:11] == "FMPR-" || e["DestChannel"][6:11] == "FMGL-") {
+           return
+       }

        c.TimeAnswer = time.Now()
        c.ChDest = e["DestChannel"]
        c.Ext = e["DestCallerIDNum"]
FaGitt commented 2 years ago

For sure!

Here we go: wo-followme.log

Thanks for the quick updates! Will test you additional line asap. Will post an update soon.

Update: Your quickfix works great for the call finishing if the connection is established. If the call is transfered to the voicemail the call will stay "open" and needs to be closed in SuiteCRM.

All updates to suiteCRM after the finishing of the call will lead to "204 No Content"