📄 call.java
字号:
{ accept(local_sdp);
}*/
/** Accepts the incoming call */
public void accept(String sdp)
{ local_sdp=sdp;
if (dialog!=null) dialog.accept(contact_url,local_sdp);
}
/** Redirects the incoming call */
public void redirect(String redirect_url)
{ if (dialog!=null) dialog.redirect(302,"Moved Temporarily",redirect_url);
}
/** Refuses the incoming call */
public void refuse()
{ if (dialog!=null) dialog.refuse();
}
/** Cancels the outgoing call */
public void cancel()
{ if (dialog!=null) dialog.cancel();
}
/** Close the ongoing call */
public void bye()
{ if (dialog!=null) dialog.bye();
}
/** Modify the current call */
public void modify(String contact, String sdp)
{ local_sdp=sdp;
if (dialog!=null) dialog.reInvite(contact,local_sdp);
}
/** Closes an ongoing or incoming/outgoing call
* <p> It trys to fires refuse(), cancel(), and bye() methods */
public void hangup()
{ if (dialog!=null)
{ // try dialog.refuse(), cancel(), and bye() methods..
dialog.refuse();
dialog.cancel();
dialog.bye();
}
}
// ************** Inherited from InviteDialogListener **************
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallIncoming()). */
public void onDlgInvite(InviteDialog d, NameAddress callee, NameAddress caller, String sdp, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (sdp!=null && sdp.length()!=0) remote_sdp=sdp;
if (listener!=null) listener.onCallIncoming(this,callee,caller,sdp,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallModifying()). */
public void onDlgReInvite(InviteDialog d, String sdp, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (sdp!=null && sdp.length()!=0) remote_sdp=sdp;
if (listener!=null) listener.onCallModifying(this,sdp,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallRinging()). */
public void onDlgInviteProvisionalResponse(InviteDialog d, int code, String reason, String sdp, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (sdp!=null && sdp.length()!=0) remote_sdp=sdp;
if (code==180) if (listener!=null) listener.onCallRinging(this,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallAccepted()). */
public void onDlgInviteSuccessResponse(InviteDialog d, int code, String reason, String sdp, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (sdp!=null && sdp.length()!=0) remote_sdp=sdp;
if (listener!=null) listener.onCallAccepted(this,sdp,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallRedirection()). */
public void onDlgInviteRedirectResponse(InviteDialog d, int code, String reason, MultipleHeader contacts, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (listener!=null) listener.onCallRedirection(this,reason,contacts.getValues(),msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallRefused()). */
public void onDlgInviteFailureResponse(InviteDialog d, int code, String reason, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (listener!=null) listener.onCallRefused(this,reason,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallTimeout()). */
public void onDlgTimeout(InviteDialog d)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (listener!=null) listener.onCallTimeout(this);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. */
public void onDlgReInviteProvisionalResponse(InviteDialog d, int code, String reason, String sdp, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (sdp!=null && sdp.length()!=0) remote_sdp=sdp;
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallReInviteAccepted()). */
public void onDlgReInviteSuccessResponse(InviteDialog d, int code, String reason, String sdp, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (sdp!=null && sdp.length()!=0) remote_sdp=sdp;
if (listener!=null) listener.onCallReInviteAccepted(this,sdp,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallReInviteRedirection()). */
//public void onDlgReInviteRedirectResponse(InviteDialog d, int code, String reason, MultipleHeader contacts, Message msg)
//{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
// if (listener!=null) listener.onCallReInviteRedirection(this,reason,contacts.getValues(),msg);
//}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallReInviteRefused()). */
public void onDlgReInviteFailureResponse(InviteDialog d, int code, String reason, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (listener!=null) listener.onCallReInviteRefused(this,reason,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallReInviteTimeout()). */
public void onDlgReInviteTimeout(InviteDialog d)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (listener!=null) listener.onCallReInviteTimeout(this);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallConfirmed()). */
public void onDlgAck(InviteDialog d, String sdp, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (sdp!=null && sdp.length()!=0) remote_sdp=sdp;
if (listener!=null) listener.onCallConfirmed(this,sdp,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onCallClosing()). */
public void onDlgCancel(InviteDialog d, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (listener!=null) listener.onCallCanceling(this,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onClosing()). */
public void onDlgBye(InviteDialog d, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (listener!=null) listener.onCallClosing(this,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onClosed()). */
public void onDlgByeFailureResponse(InviteDialog d, int code, String reason, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (listener!=null) listener.onCallClosed(this,msg);
}
/** Inherited from class InviteDialogListener and called by an InviteDialag. Normally you should not use it. Use specific callback methods instead (e.g. onClosed()). */
public void onDlgByeSuccessResponse(InviteDialog d, int code, String reason, Message msg)
{ if (d!=dialog) { printLog("NOT the current dialog",LogLevel.HIGH); return; }
if (listener!=null) listener.onCallClosed(this,msg);
}
// -----------------------------------------------------
/** When an incoming INVITE is accepted */
//public void onDlgAccepted(InviteDialog dialog) {}
/** When an incoming INVITE is refused */
//public void onDlgRefused(InviteDialog dialog) {}
/** When the INVITE handshake is successful terminated */
public void onDlgCall(InviteDialog dialog) {}
/** When an incoming Re-INVITE is accepted */
//public void onDlgReInviteAccepted(InviteDialog dialog) {}
/** When an incoming Re-INVITE is refused */
//public void onDlgReInviteRefused(InviteDialog dialog) {}
/** When a BYE request traqnsaction has been started */
//public void onDlgByeing(InviteDialog dialog) {}
/** When the dialog is finally closed */
public void onDlgClose(InviteDialog dialog) {}
//**************************** Logs ****************************/
/** Adds a new string to the default Log */
protected void printLog(String str, int level)
{ if (log!=null) log.println("Call: "+str,level+SipStack.LOG_LEVEL_CALL);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -