Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

res.send fnAck is not called #70

Closed
spointer opened this issue Nov 25, 2019 · 9 comments
Closed

res.send fnAck is not called #70

spointer opened this issue Nov 25, 2019 · 9 comments

Comments

@spointer
Copy link

Hi Dave,

If the remote server send re-INVITE, i just send 200 OK with the current dialog's local sdp and the remote server send ack to me but it seems no fnAck callback is called.

I just implemented the dialog modify event like this.

dialog.on('modify', (req, res) => {
    res.send(200, {
        body: dialog.local.sdp
    },
    (err, sent) => {
        if(err) {
            console.log(err);
        }            
    },
    () => {
        console.log('fnAck');
    });
})

SIP messages are as follows:

// re-INVITE from remote(no sdp)
2019-11-21 02:26:01.635942 recv 581 bytes from udp/[121.255.185.19]:3551 at 02:26:01.635839:
INVITE sip:2001@172.25.0.2:3601 SIP/2.0
Via: SIP/2.0/UDP 10.1.32.34:3551;branch=z9hG4bKe4bcbdc7015e4f62bcd4bdab905cfd7a
From: "2001"sip:3201@10.1.32.34:3551;tag=7a4df4ebb2d5430f8128211f8c37455b
To: sip:2001@172.25.0.2:3601;tag=gK90327p45c4j
Call-ID: 6dadae111eb345fd80b6965c761e6ccc@10.1.32.34:3551
CSeq: 157 INVITE
Max-Forwards: 70
Contact: sip:2001@10.1.32.34:3551
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, INFO
Supported: replaces
User-Agent: K 2.2.2
P-Asserted-Identity: sip:2001@10.1.32.34:3551
Content-Length: 0

2019-11-21 02:26:01.636565 send 364 bytes to udp/[121.255.185.19]:3551 at 02:26:01.636431:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.1.32.34:3551;branch=z9hG4bKe4bcbdc7015e4f62bcd4bdab905cfd7a;received=121.255.185.19;rport=3551
From: "2001"sip:3201@10.1.32.34:3551;tag=7a4df4ebb2d5430f8128211f8c37455b
To: sip:2001@172.25.0.2:3601;tag=gK90327p45c4j
Call-ID: 6dadae111eb345fd80b6965c761e6ccc@10.1.32.34:3551
CSeq: 157 INVITE
Content-Length: 0

// res.send
2019-11-21 02:26:01.688465 send 665 bytes to udp/[121.255.185.19]:3551 at 02:26:01.688286:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.1.32.34:3551;branch=z9hG4bKe4bcbdc7015e4f62bcd4bdab905cfd7a;received=121.255.185.19;rport=3551
From: "2001" sip:3201@10.1.32.34:3551;tag=7a4df4ebb2d5430f8128211f8c37455b
To: sip:2001@172.25.0.2:3601;tag=gK90327p45c4j
Call-ID: 6dadae111eb345fd80b6965c761e6ccc@10.1.32.34:3551
CSeq: 157 INVITE
Contact: sip:172.25.0.2:3601
Content-Type: application/sdp
Content-Length: 239

v=0
o=- 1574303161 1574303163 IN IP4 121.182.10.18
s=c
c=IN IP4 121.182.10.18
t=0 0
m=audio 10598 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

// ack with sdp
2019-11-21 02:26:01.753607 recv 703 bytes from udp/[121.255.185.19]:3551 at 02:26:01.753462:
ACK sip:2001@172.25.0.2:3601 SIP/2.0
Via: SIP/2.0/UDP 10.1.32.34:3551;branch=z9hG4bK60455c20dfa1438790e254689baf6451
From: "2001"sip:3201@10.1.32.34:3551;tag=7a4df4ebb2d5430f8128211f8c37455b
To: sip:2001@172.25.0.2:3601;tag=gK90327p45c4j
Call-ID: 6dadae111eb345fd80b6965c761e6ccc@10.1.32.34:3551
CSeq: 157 ACK
Contact: sip:2001@10.1.32.34:3551
User-Agent: K 2.2.2
Max-Forwards: 70
Content-Type: application/sdp
Content-Length: 238

v=0
o=AudiocodesGW 407398170 407398144 IN IP4 10.1.132.21
s=Phone-Call
c=IN IP4 10.1.32.34
t=0 0
m=audio 10974 RTP/AVP 8 101
c=IN IP4 10.1.32.34
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15

@spointer
Copy link
Author

I think the remote server sends ack with different Via branch.

Do you think this is likely to be the cause?

@davehorton
Copy link
Collaborator

No, I dont think so. The ACK to a 200 OK is supposed to have a new VIa branch

@spointer
Copy link
Author

spointer commented Dec 3, 2019

So, why fnAck is not called?

I see these codes on drachtio-agent.js here

    if (fnAck && typeof fnAck === 'function' &&
      (responseMsg.has('RSeq') || res.status === 200)) {
      obj.pendingAckOrPrack.set(meta.dialogId, fnAck) ;
    }

and here

        else if (('PRACK' === req.method || 'ACK' === req.method) && obj.pendingAckOrPrack.has(dialogId)) {
          const fnAck = obj.pendingAckOrPrack.get(dialogId);
          obj.pendingAckOrPrack.delete(dialogId);
          fnAck() ;
        }

Is there any possibility dialogId not matched?
Do you need more drachtio-srf or drachtio-server logs to find the cause? i could reproduce and send logs to you.

Thank you.

@spointer
Copy link
Author

spointer commented Dec 3, 2019

I could get the meta object and it has following data.
{ source: 'application',
address: '121.255.185.19',
port: '3551',
protocol: 'udp',
time: '05:49:35.546007',
transactionId: '17759f31-10f1-46b2-8b95-a8c776548a9a',
dialogId: '' }

So, pendingAckOrPrack Map has empty key and fnAck function value, but parsed dialogId variable of _onMsg's token has "c3282b5eff174b7e86e0a90ef3ec87b3@10.1.32.34:3551;from-tag=3254d1188e224139a03edd619f912a85" and fnAck never called.

i could not know the reason of empty dialogId, could you give me any suggestions?
Thank you.

@spointer
Copy link
Author

spointer commented Dec 3, 2019

Anyway, is there any correct way to get the Ack request object? Because the remote server sends SDP body within ack and i should get the sdp body and parse it.

@spointer
Copy link
Author

Hi Dave,
Is there any update here?
If you need more information for resolving this issue, please let me know. Thank you.

@davehorton
Copy link
Collaborator

sorry for the delay on this; thx for your patience. Been super busy but will look into and have an update tomorrow

davehorton added a commit that referenced this issue Dec 12, 2019
…RACK message as a parameter (partial fix for #70)
@davehorton
Copy link
Collaborator

this actually required a fix in drachtio server. You will need to upgrade to v0.8.4-rc5 (or latest develop branch) of the drachtio server.

Additionally, I noticed that when calling the fnAck function I was not passing the ACK or PRACK message itself, which I'm guessing you may want if you need to examine the SDP included in the body. If you want the function to be invoked passing the ack message (i.e. fnAck(ack)) then upgrade to drachtio-srf@4.4.24

After updating your code please retest and let me know if this resolves your issue.

@spointer
Copy link
Author

spointer commented Dec 13, 2019

It worked after updated drachtio-server(v0.8.3-13-ge19fe9216) and drachtio-srf(4.4.25).

The fnAck callback is called and i could get ack req object and parse. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants