简体   繁体   English

PJSIP 接收到的远程 Sip 报头

[英]PJSIP Received Remote Sip Header

Let's asssume we've two phone and Phone1 & Phone2 they're both has custom sip header假设我们有两部电话,Phone1 和 Phone2,它们都有自定义的 sip 头

[Phone1] ----calling----> [Phone2] (This is onIncomingCallState for Phone2 and it can read header of Phone1) [Phone1] ----calling----> [Phone2] (这是Phone2的onIncomingCallState,可以读取Phone1的header)

[Phone1] <----answer---- [Phone2] (This is answer for Phone2 and it send it's header with it's CallOpParam) [Phone1] <----answer---- [Phone2] (这是 Phone2 的应答,它发送带有 CallOpParam 的标头)

[Phone1] <----OnCallState----> [Phone2] (This is on call state for both, Phone2 has Phone1's header, now Phone1 need to get Phone2's header.) [Phone1] <----OnCallState----> [Phone2] (这是通话状态,Phone2有Phone1的header,现在Phone1需要得到Phone2的header。)

I'm writing the code at the level of PjSua2 with C++, i can see the log, Phone1 has access the value of header and when i sniff also with the wireshark i can see as well.我正在用 C++ 编写 PjSua2 级别的代码,我可以看到日志,Phone1 可以访问 header 的值,当我也用wireshark 嗅探时,我也可以看到。 But how can i handle it at the level of pjsua2, is there any call back or something else?但是我如何在 pjsua2 级别处理它,是否有任何回调或其他什么?

Usually there are callbacks, in the on_call_media_state .通常有回调,在on_call_media_state Here is some bare minimum:这是一些最低要求:

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();
            }
        }
     }
}

Taken from repositry https://github.com/heatblazer/asteriks-debugger/blob/master/Sip/sipapp.cpp取自存储库https://github.com/heatblazer/asteriks-debugger/blob/master/Sip/sipapp.cpp

So can you provide more info on what exactly you are missing?那么你能提供更多关于你到底缺少什么的信息吗?

Actually, it is already implemented in the pjsua2 level.实际上,它已经在 pjsua2 级别实现了。

virtual void onCallState(OnCallStatePrm &prm){
..
prm.e.body.tsxState.src.rdata.wholeMsg //this is what i want exactly.
..
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM