Could you please give a idea of how to use REFER method in JAIN SIP API in java. I would like to use REFER method because i would to use call transfer.
Asked
Active
Viewed 248 times
1 Answers
0
If you already established a SIP dialog it's pretty simple:
public void sendRefer(String to, String by) throws Exception, SipException {
Request req = dialog.createRequest("REFER");
req.addHeader(headerFactory.createHeader("Refer-To", "sip:"+to+"@"+realm));
req.addHeader(headerFactory.createHeader("Referred-By", "sip:"+by+"@"+realm));
dialog.sendRequest(provider.getNewClientTransaction(req));
}
If you are dialog-stateless it's a bit more complicated and it you will have to build it as a subsequent request.

Vladimir Ralev
- 1,371
- 9
- 18
-
Thank you :) . I have added this method. but when i run, refer is succeeded but the call is not being transferred. should I add anything more or enable to get this working. please advise :) – supradha - Jul 30 '18 at 15:13
-
If REFER succeeded I guess you mean that you got OK from the other side? If you got OK from the other side then you should check their logs to see why they ignored it. There are many types of transfers and each vendor supports different kinds. This is the simplest blind transfer. AN attended transfer will require a Replaces header as well and it gets even more complicated after that. – Vladimir Ralev Jul 30 '18 at 16:15
-
No Im haven't not got OK from other side I believe. the refer request sent is succeed and received 202 accepted and a notify message is being sent, but i get "bye" after that. Could you please advise me how to fix this. Note: Only the transferor is SIP accounted. other phones are not. i used this picture for reference [link](https://andrewjprokop.wordpress.com/2014/03/17/refer-revisited/) – supradha - Jul 30 '18 at 16:52
-
202 accepted is great, your app is working, you probably just need to aim the transfer correctly. It's normal to receive a BYE, because it's a blind transfer. Check if there is a reason header if it's a failure of some kind. Most likely the transfer target is not resolve-able in the 3rd party server. Check your server logs to find out why. – Vladimir Ralev Jul 30 '18 at 20:12
-
Thank you for your help.. :) . Just a small doubt, should i trigger invite event from Transferee to Transfer target in my java code or how should the process invite be triggered after sending refer request. could you please advise me. – supradha - Jul 31 '18 at 13:58
-
It is generally a responsibility of the server to send reINVITEs in "most" blind transfers. In attended transfers the Transferor should send another INVITE in all cases. But this is blind transfer so you shouldn't do anything. However there are many kinds of transfers. Check your server's guide what kind of transfers they support. If this is freeswitch or asterisk it should by default as long as the target is a known user. – Vladimir Ralev Jul 31 '18 at 18:31