高手请指点一下:应该怎么产生反极信号???
我用siptheeskype(skype2sip的软件,开源,基于java技术,该软件主要应用了skype一个接口和mjsip,)实现了用ip电话机直接拨打skypeout电话,但我想在对方接电话的时候,也就是siptheeskype显示处于inprogress状态的时候产生反极信号,应该如何修改该软件?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
看开点吧……让运营商去计费好了
要给什么设备产生反极信号?
4楼回答太经典了!!!!!!
打10060或者10000
看的迷迷糊糊的。
[ 本帖最后由 fireluxbo 于 2009-2-3 00:52 编辑 ]
下面贴出相关的一些代码,请高手帮看看:
/** When a sip call has been locally or remotely closed */
public void onUaCallClosed(UserAgent tua)
{
log.debug("onUaCallClosed");
listen();
}
// dmf received from sip
public void onDtmfReceived(UserAgent tua,int digit,boolean isSkype)
{
//log.debug("onDtmfReceived digit:"+digit+" sipDtmfBuffer="+ua.getDtmfBuffer()+" skypeDtmfBuf:"+ua.getSkypeDtmfBuffer());
if (!isSkype)
{
if (callAuthState==AuthState.SIP_WAITFORPIN)
{
if (tua.getDtmfBuffer().startsWith(authPin))
{
// got auth pin, send dest prompt and wait for dest entry
authFailCnt=0;
clearAuthTimer();
if (doPinCalleeDial)
{
callAuthState=AuthState.IDLE;
String skypeDest=curSipCallee.replaceAll("(?i).*sip:<?([^@<]+)@.*", "$1");
if (directSkypeDial(skypeDest))
this.ua.queueSipClip(skype_profile.dialingFile); // would be nicer if we sent ring to sip device
}
else
{
callAuthState=AuthState.SIP_WAITFORDESTINATION;
log.info("Pin Authorized");
tua.chopDtmfBuffer(authPin.length());
this.ua.queueSipClip(skype_profile.destinationFile);
startAuthTimer(skype_profile.destinationTimeout);
}
}
}
else if (callAuthState==AuthState.SIP_WAITFORDESTINATION)
{
if (tua.getDtmfBuffer().indexOf("#")>=0)
{
// got end of dest entry, send dialing sound, make the skype call
authFailCnt=0;
clearAuthTimer();
callAuthState=AuthState.IDLE;
String skypeDest=ua.getDtmfBuffer().replaceAll("#.*$", "").trim();
this.ua.clearDtmfBuffer();
if (skypeDest.length()>0)
{
// make the skype Call
log.info("Dialing Skype Destination:"+skypeDest);
if (!makeSkypeCall(skypeDest))
{
log.info("Skype Call Failed");
callAuthState=AuthState.SIP_WAITFORDESTINATION;
this.ua.queueSipClip(skype_profile.invalidDestFile);
this.ua.queueSipClip(skype_profile.destinationFile);
startAuthTimer(skype_profile.destinationTimeout);
}
else
this.ua.queueSipClip(skype_profile.dialingFile); // would be nicer if we sent ring to sip device
}
else
{
callAuthState=AuthState.SIP_WAITFORDESTINATION;
this.ua.queueSipClip(skype_profile.destinationFile);
startAuthTimer(skype_profile.destinationTimeout);
}
}
}
else if (currentSkypeCall!=null && !this.ua.skypeHoldingLocal)
{
if (this.skype_profile.sendSipDtmfToSkype)
{
try
{
if (currentSkypeCall.getStatus()==Call.Status.INPROGRESS)
{
int fixDigit=digit;
if (digit==10)
fixDigit=Call.DTMF.TYPE_ASTERISK.ordinal();
else if (digit==11)
fixDigit=Call.DTMF.TYPE_SHARP.ordinal();
if (fixDigit<=11)
{
currentSkypeCall.send(Call.DTMF.values()[fixDigit]);
log.debug("DTMF:"+digit+" sent to skype");
}
}
}
catch (Exception e)
{
log.error("Error sending dtmf: "+digit+" to skype: ",e);
}
}
}
else if (callAuthState==AuthState.IDLE)
{
log.debug("Auth State not handled:"+callAuthState);
}
}
else
{
if (callAuthState==AuthState.SKYPE_WAITFORPIN)
{
if (this.ua.getSkypeDtmfBuffer().startsWith(authPin))
{
// got auth pin, send dest prompt and wait for dest entry
authFailCnt=0;
clearAuthTimer();
callAuthState=AuthState.SKYPE_WAITFORDESTINATION;
log.info("Pin Authorized");
this.ua.chopSkypeDtmfBuffer(authPin.length());
this.ua.queueSkypeClip(skype_profile.skypeDestinationFile);
startAuthTimer(skype_profile.destinationTimeout);
}
}
else if (callAuthState==AuthState.SKYPE_WAITFORDESTINATION)
{
if (this.ua.getSkypeDtmfBuffer().indexOf("#")>=0)
{
// got end of dest entry, send dialing sound, make the skype call
authFailCnt=0;
clearAuthTimer();
callAuthState=AuthState.IDLE;
String sipDest=ua.getSkypeDtmfBuffer().replaceAll("#.*$", "").trim();
sipDest=authMaps.sipOutFilter(sipDest);
this.ua.clearSkypeDtmfBuffer();
if (sipDest.length()>0)
{
log.info("Dialing Sip Destination:"+sipDest);
this.ua.queueSkypeClip(skype_profile.skypeDialingFile); // would be nicer if we sent ring to skype
this.waitForSkypeClipsComplete();
// make the sip Call
this.call(sipDest);
}
else
{
callAuthState=AuthState.SKYPE_WAITFORDESTINATION;
this.ua.queueSkypeClip(skype_profile.skypeDestinationFile);
startAuthTimer(skype_profile.destinationTimeout);
}
}
}
else if (this.ua.call_state!=UserAgent.UA_IDLE && !this.ua.onLocalSipHold)
{
if (this.skype_profile.sendSkypeDtmfToSip)
{
this.ua.queueSipDtmfDigits(this.ua.dtmfConvertToString(digit));
log.debug("DTMF:"+digit+" sent to sip");
}
}
else if (callAuthState==AuthState.IDLE)
{
log.debug("Auth State not handled:"+callAuthState);
}
}
}
// AuthTimerInterface callback
public void onAuthTimeout()
{
authTimer=null;
if (callAuthState!=AuthState.IDLE)
{
authFailCnt++;
if (callAuthState==AuthState.SIP_WAITFORPIN)
{
log.info("Pin timeout");
if (this.ua.getDtmfBuffer().length()>0 && authFailCnt<skype_profile.pinRetryLimit) // they tried, so restart
{
this.ua.queueSipClip(skype_profile.invalidPinFile);
this.ua.clearDtmfBuffer();
this.ua.queueSipClip(skype_profile.pinFile);
startAuthTimer(skype_profile.pinTimeout);
}
else
{
this.ua.queueSipClip(skype_profile.invalidPinFile);
waitForSipClipsComplete();
listen();
}
}
else if (callAuthState==AuthState.SIP_WAITFORDESTINATION)
{
log.info("Destination timeout");
if (this.ua.getDtmfBuffer().length()>0 && authFailCnt<skype_profile.destRetryLimit) // they tried, so restart
{
this.ua.queueSipClip(skype_profile.invalidDestFile);
this.ua.clearDtmfBuffer();
this.ua.queueSipClip(skype_profile.destinationFile);
startAuthTimer(skype_profile.destinationTimeout);
}
else
{
this.ua.queueSipClip(skype_profile.invalidDestFile);
waitForSipClipsComplete();
listen();
}
}
else if (callAuthState==AuthState.SKYPE_WAITFORPIN)
{
log.info("Pin timeout");
if (this.ua.getSkypeDtmfBuffer().length()>0 && authFailCnt<skype_profile.pinRetryLimit) // they tried, so restart
{
this.ua.queueSkypeClip(skype_profile.skypeInvalidPinFile);
this.ua.clearSkypeDtmfBuffer();
this.ua.queueSkypeClip(skype_profile.skypePinFile);
startAuthTimer(skype_profile.pinTimeout);
}
else
{
this.ua.queueSkypeClip(skype_profile.skypeInvalidPinFile);
waitForSkypeClipsComplete();
cancelSkypeCall();
unLock();
}
}
else if (callAuthState==AuthState.SKYPE_WAITFORDESTINATION)
{
log.info("Destination timeout");
if (this.ua.getSkypeDtmfBuffer().length()>0 && authFailCnt<skype_profile.destRetryLimit) // they tried, so restart
{
this.ua.queueSkypeClip(skype_profile.skypeInvalidDestFile);
this.ua.clearSkypeDtmfBuffer();
this.ua.queueSkypeClip(skype_profile.skypeDestinationFile);
startAuthTimer(skype_profile.destinationTimeout);
}
else
{
this.ua.queueSkypeClip(skype_profile.skypeInvalidDestFile); // hangup after
waitForSkypeClipsComplete();
cancelSkypeCall();
unLock();
}
}
else
{
cancelSkypeCall();
listen();
}
}
}