Code Monkey home page Code Monkey logo

Comments (17)

JSimoni42 avatar JSimoni42 commented on August 12, 2024

It looks like this is where the CANCEL event is emitted:

obj.pendingNetworkInvites.get(callId).req.emit('cancel', sipMsg) ;
. You can get the headers from the SipMessage passed to the event listener

from drachtio-srf.

calvet27 avatar calvet27 commented on August 12, 2024

@JSimoni42 ,

Thank you for your answer.
But I already tried to do that,

req.on('cancel', async (cancelReq) => {
...
});

But I think cancelReq.headers is not define.
Actually, I double checked that cancelReq is undefined in that case.
Is it a req object from CANCEL?

from drachtio-srf.

davehorton avatar davehorton commented on August 12, 2024

@xquanluu can you comment? I think we just dealt with this requirement recently

from drachtio-srf.

xquanluu avatar xquanluu commented on August 12, 2024

Take a look at this example:

expectCancel(uri) {
    this.srf.invite((req, res) => {
      req.on('cancel', (cancelReq) => {
        const headers = cancelReq.headers;
        console.log(headers);
      })
      this.srf.createB2BUA(req, res, uri)
        .then(({uas, uac}) => {
          throw new Error('unexpected dialog success - expected CANCEL from uac');
        })
        .catch((err) => {
          debug(`expectCancel: expected a final 487, got ${err}`);
          if (err.status === 487) return;
          throw err;
        });
    });
  }

Output:

{
via: 'SIP/2.0/UDP 172.29.0.2:5060;branch=z9hG4bK-1-1-0;rport=5060',
from: 'sipp sip:[email protected]:5060;tag=1SIPpTag001',
to: 'service sip:[email protected]:5060',
'call-id': '[email protected]',
cseq: '1 CANCEL',
reason: 'SIP;cause=200;text="Call completed elsewhere"',
'content-length': '0'
}

from drachtio-srf.

xquanluu avatar xquanluu commented on August 12, 2024

Not sure is what you are looking for? @calvet27

from drachtio-srf.

xquanluu avatar xquanluu commented on August 12, 2024

You may want to play with this testcase:
https://github.com/drachtio/drachtio-srf/blob/main/test/scripts/b2b.js#L24

from drachtio-srf.

calvet27 avatar calvet27 commented on August 12, 2024

@xquanluu

Can you give me version information about supporting cancelReq?

from drachtio-srf.

xquanluu avatar xquanluu commented on August 12, 2024

Can you use drachtio-srf: 4.5.28
drachtio-server: latest

from drachtio-srf.

calvet27 avatar calvet27 commented on August 12, 2024

@xquanluu

I use 4.4.18. After updating to 4.5.28, I will let you know the results.

from drachtio-srf.

calvet27 avatar calvet27 commented on August 12, 2024

@xquanluu

Can I get you tag information of the latest drachtio?
Is it same with 0.8.22?

from drachtio-srf.

xquanluu avatar xquanluu commented on August 12, 2024

Yes it's correct.

from drachtio-srf.

calvet27 avatar calvet27 commented on August 12, 2024

@xquanluu
But it looks different.
0.8.22 does not give me cancel object but latest give me.
I updated drachtio-srf to 4.5.26.
Any advice?

from drachtio-srf.

xquanluu avatar xquanluu commented on August 12, 2024

Can you tell me how you build and deployed drachtio? via docker?

from drachtio-srf.

calvet27 avatar calvet27 commented on August 12, 2024

@xquanluu
Yes. I installed Drachtio SIP Server via Docker. The image is from Docker hub.
Drachtio

I had some tests to compare 0.8.22 and latest and then I noticed that the only the latest one worked properly.
cancelReq is undefined with 0.8.22 and Drachtio SRF 4.5.26 was used for both cases.

from drachtio-srf.

xquanluu avatar xquanluu commented on August 12, 2024

hmm. Strange but yes please use latest tag.,

0.8.2 was released 2 months ago, from that time up to now there is no official release yet.

from drachtio-srf.

calvet27 avatar calvet27 commented on August 12, 2024

@xquanluu

I'm sorry to make you confused. Now 0.8.22 works properly.
Close this issue! Thank you for your support!

from drachtio-srf.

xquanluu avatar xquanluu commented on August 12, 2024

Closing this issue.

from drachtio-srf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.