我创建了一个Android应用程序,除了其他与Sip相关的操作外,还需要从SIP服务器接收SIP消息。
为此,我使用linphone adroid sdk库。
我的主要要求是,如果从Sip服务器接收到SIP消息,该消息在其主体中包含一些特定的自定义数据,则应回答200 ok。
但是,当SIP MESSAGE忽略此数据时,应用程序应回复606不可接受。
到目前为止,我还没有找到在android级别上实现该目标的方法。
搜索库文件后,我在文件linphone/coreapi/callbacks.c
static void message_received(SalOp *op,const SalMessage *msg){
LinphoneCore *lc=(LinphoneCore *)op->getSal()->getUserPointer();
if (!check_core_state(lc,op))
return;
LinphoneCall *call=(LinphoneCall*)op->getUserPointer();
LinphoneReason reason = lc->chat_deny_code;
if (reason == LinphoneReasonNone) {
reason = linphone_core_message_received(lc,op,msg);
}
auto messageOp = dynamic_cast<SalMessageOpInterface *>(op);
messageOp->reply(linphone_reason_to_sal(reason));
if (!call) op->release();
}
我假设这是处理SIP消息并根据sip协议规范自动回复的回调。
我的第一个想法是根据我的标准修改回复部分。
但是,由于不建议在新版本的情况下修改库,是否还有另一种方式我可能会错过这种方法而无需修改库,因为我已经进行了很多搜索但是没有找到任何可靠的信息。
如果这是唯一的方法,那么有人知道支持自定义sip响应代码的android库吗?
预先感谢。