Code Monkey home page Code Monkey logo

Comments (8)

davehorton avatar davehorton commented on September 16, 2024 1

OK, just published [email protected], which adds

findDialogById(stackDialogId), and
findDialogByCallIDAndFromTag(callId, tag)

Note: these functions require [email protected] or above (currently the head of the 'develop' branch), which formats dialog ids as {Call-ID};from-tag={from-tag}.

additionally, if you have a reference to a dialog (uas or uac) that was created by Srf#createB2BUA then dialog.other will be a reference to the paired dialog.

So handling attended transfer should be a matter of:

  • parsing the Refer-To header (I think I need to add a utility function somewhere to make that easier, probably in drachtio-sip), then
  • calling findDialogByCallIDAndFromTag(callId, tag) to retrieve the dialog being replaced, then
  • reinviting the paired dialog by calling Dialog#modify on dialog.other.

I'll leave this issue open for now until you have time to test.

from drachtio-srf.

davehorton avatar davehorton commented on September 16, 2024

Thanks very much for the gist with the ladder diagram, that illustrates the problem clearly.

I'm not sure I totally follow the logic above (I think I'm confused by what seems the reverse use of 'every' instead of simply 'find'), but it seems like the issue is that we need to retrieve an existing dialog (the transferree dialog) from the internal map of dialogs that srf keeps. And we need to do that by Call-ID, is that correct?

Should we just add a public method to Srf to return a dialog by call-id?

Unfortunately, it is the case that a call-id could be used on two different dialogs, though that is undesirable and somewhat unlikely (the app would have to force the call-id on different legs).

Perhaps we could also add some standard implementation for attended transfer to https://github.com/davehorton/drachtio-fn-b2b-sugar ?

from drachtio-srf.

davehorton avatar davehorton commented on September 16, 2024

also, let's try not to assume that the format of the dialog id is the calling =+[";uas"|";uac"] quite yet. I'm looking into changing that to be more correctly some combination of the callid and from tag

from drachtio-srf.

davehorton avatar davehorton commented on September 16, 2024

I'm testing a new branch in drachtio-server called 'dialog-naming' to test a change in assigning dialog ids -- they will now be ${callid};from-tag=${fromTag}, which will be more strictly correct. So hold off on any hardcoding in your app of dialog id construction, and once I merge this branch I will add a public method in Srf to return a dialog given the call-id and the from tag, which I think will support the attended transfer scenario nicely

from drachtio-srf.

byoungdale avatar byoungdale commented on September 16, 2024

Yeah, I think that will work since the Replaces headers includes the from-tag and to-tag. But, the hard part is that we actually need the dialog on the other side of the B2BUA call, since that is the dialog we need to update for the transfer.

Here is an example of the current dialog map:

srf._dialogs = [
121314, # call B
891011;uas, # call B
4567, # call A
1234;uas # call A
]

So, currently, if the Replaces header has the Call-ID 4567, I actually need to update the 1234;uas dialog.

from drachtio-srf.

davehorton avatar davehorton commented on September 16, 2024

ah, ok, then here is what I think we do:

first, I've already merged the change to the develop branch of drachtio-server to format the dialog id as suggested above. This is in version v0.8.2-rc2, which you will need to test against once all of this is ready.

In upcoming [email protected], I will add two methods:

Srf#findDialogById(stackDialogId)
Srf#findDialogByCallIDAndFromTag(callId, tag)

also, as part of createB2BUA the {uas, uac} SipDialogs that are returned will each have a reference to each other via the 'other' property, e.g.
uas.other === uac && uac.other === uas

So therefore, your code should (I think) only have to:

  • parse the Refer-To header in the REFER, get the call-id and from tag
  • call srf.findDialogByCallIDAndFromTag(callId, tag) to retrieve the dialog being replaced
  • then send the re-INVITE on dlg.other

Does that make sense?

I want to add a test case for this before I push the changes

from drachtio-srf.

byoungdale avatar byoungdale commented on September 16, 2024

Yeah, that makes sense and will work great. Thanks!

from drachtio-srf.

byoungdale avatar byoungdale commented on September 16, 2024

I was able to test. This worked great! Thank you so much

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.