There are four different ways to handle “transfers”, using the term loosely.
Routing two calls together
This keeps the two calls “bridged” and the call traffic remains inside the system. This is done by:
m_ChannelResource.RouteFull(m_SecondCallLeg) // Where m_SecondCallLeg is also a channel resource that is hosting another call leg.
SIP REDIRECT
This is a case where you actually don’t answer the call. Here you can examine the DID and the ANI and then decide to send the call elsewhere. To do this, you have to cast the channel resource as a SIP channel:
SipChannel sip = m_ChannelResource as SipChannel; if (sip != null) { sip.Redirect("13035551212@123.123.123.123"); }
SIP REINVITE
This allows you to keep “control” of the call, but lets you redirect the streams of the RTP data. The REINVITE takes a few optional parameters:
- rtpCodec – Used to specify a new codec.
- rtpAddress – User to specify a new address for the RTP stream
- rtpPort – used to specify a new port
- rtpSdp – used to specify an entirely new SDP block
For example, to REINVITE the carrier to switch codecs to G729:
//For REINVITE, You have to cast the channel to a SIP channel as in the REDIRECT. Then: Sip.Reinvite("g729AnnexA", "", 0, "");
SIP REFER
This has two flavors: Attended and Unattended.
- In the Attended mode, you place the second call leg and then issue the REFER to your carrier. If the carrier supports this, it will take both calls and tie them together and then send BYEs back to us, removing us from the loop.
- In Unattended Mode, you are simply telling the carrier to take the first call leg and “send” it to a new destination. In this case the carrier, if they support this, will send a BYE and drop the call.
- The best way to test these is to use WireShark and capture the SIP signaling on port 5060. Then you can watch the messaging going between Voice Elements and your carrier.
//For REFER, You have to cast the channel to a SIP channel as in the REDIRECT. Then: sip.Refer(“13035551212@123.123.123.123”); // For unattended sip.Refer(m_SecondCallLeg); // For Attended