假设我们有两个phone和Phone1 &Phone2都有自定义sip头
[Phone1] ----calling----> [Phone2]
(这是Phone2的onIncomingCallState,它可以读取Phone1的标头)
[Phone1] <----answer---- [Phone2]
(这是对Phone2的回答,它发送它的头与它的CallOpParam)
[Phone1] <----OnCallState----> [Phone2]
(这是对呼叫状态,Phone2有Phone1的头,现在Phone1需要得到Phone2的头)
我正在用c++编写PjSua2级别的代码,我可以看到日志,Phone1可以访问header的值,当我用wireshark嗅探时,我也可以看到。但是我如何在pjsua2级别处理它,是否有回调或其他什么?
通常在on_call_media_state
中有回调。以下是一些最小值:
void SipApp::on_call_media_state(pjsua_call_id call_id)
{
pjsua_call_info info;
pjsua_call_get_info(call_id, &info);
if (info.media_status == PJSUA_CALL_MEDIA_ACTIVE) {
//pjsua_conf_connect(0, info.conf_slot);
pjsua_conf_connect(info.conf_slot, g_recorder->getSlot());
for(int i=0; i < g_players.count(); i++) {
g_players.at(i)->setSrc(info.conf_slot);
}
g_recorder->setSrc(info.conf_slot);
g_recorder->start();
// rtsp setup - start streaming the conf to a remote IP
if(1){
if (p_rtsp->asServer()) {
p_rtsp->setSrc(0);
p_rtsp->start_streaming();
} else {
p_rtsp->setSrc(0);
p_rtsp->start_recording();
}
}
}
}
取自存储库https://github.com/heatblazer/asteriks-debugger/blob/master/Sip/sipapp.cpp
所以你能提供更多的信息,你到底错过了什么?
实际上,它已经在pjsua2级别实现了。
virtual void onCallState(OnCallStatePrm &prm){
..
prm.e.body.tsxState.src.rdata.wholeMsg //this is what i want exactly.
..
}