使用Resiprocate SIP堆栈转发SIP请求/响应
Forwarding SIP requests/responses using Resiprocate SIP stack
我需要使用Resiprocate SIP堆栈在C++中实现SIP代理。代理必须始终位于UAC和UAS之间,并简单地双向转发传入的SIP请求和响应。
根据我对SIP协议的阅读/理解,如果SIP代理想要位于UAC和UAS之间,它必须将其SIP地址注入到它正在接收的SIP消息的路由字段中。有人能告诉我如何在代理实现中添加/手动填充传入SIP消息中的路由字段吗?更确切地说,我需要知道的是我应该引用哪些头文件/类/句柄函数?我对SIP和resiprocate有点陌生,在某种程度上迷失了它的源代码。提前谢谢。
第页。S: 人们可能会想,为什么我不使用resiprocate自己的代理实现。这是因为我需要简单地使用SIP堆栈API本身来开发一个轻量级原型以满足特殊需求。原型应该只是充当SIP流量中的转发器,仅此而已。
Following在else块中完成任务。
void insertRouteField(SipMessage * received)
{
ErrLog ( << "***********************************n");
NameAddr& to = received->header(h_To);
ErrLog ( << "To Field: " << to.uri().toString());
NameAddr& from = received->header(h_From);
ErrLog ( << "From Field: " << from.uri().toString() );
ParserContainer<NameAddr>& rRoutes = received->header(h_RecordRoutes);
if(!rRoutes.empty())
{
NameAddr& frontRRoute = rRoutes.front();
ErrLog ( << "rRoutes: " << frontRRoute.uri().toString());
ErrLog ( << "***********************************n");
}
else
{
NameAddr route;
route.uri().scheme() = "sip";
route.uri().user() = "proxy";
route.uri().host() = SipStack::getHostname();
route.uri().port() = 5070;
route.uri().param(p_transport) = Tuple::toData(mTransport);
rRoutes.push_front(route);
NameAddr& frontRRoute = rRoutes.front();
ErrLog ( << "rRoute: " << frontRRoute.uri().toString());
ErrLog ( << "***********************************");
}
}
您可能想要查看的标题文件:"resip/stack/Helper.hxx"resip/stack/SipMessage.hxx"resip/stack/Uri.hxx"resip/stack/SipStack.hxx"rutil/Logger.hxx"rutil/ThreadIf.hxx"resp/stack/PaserContainer.hxx">
相关文章:
- 当服务中的事件被触发时,如何将响应从服务发送回客户端?
- C++ 信号和插槽不工作:插槽不响应事件
- NodeJs 服务器充斥着 UDP 广播,不发送响应
- C++关于ENUM的问题。我得到的响应比枚举列表大
- 应用程序在打开的简历中捕获视频后没有响应
- 使用 cpprest (Casablanca) 返回 PDF 响应
- Incomings Call with Android Sip stack in Embarcadero C++ bui
- 为什么当通过 TCP 发送的消息速率增加时,请求-响应消息对的延迟会降低?
- 如何使用从处理程序调度的最终回调将响应异步返回给调用方on_read?
- 获取加密的正文响应WinHttp HTTPS
- QtConcurrent - 在发布到 UI 线程的数千个结果中保持 GUI 响应
- 同步读取多个 TCP 响应
- HTTP 响应格式不正确?
- 如何使用软化工具包从 OPC UA 服务器异步读取操作回调中的数据值响应中获取 NodeId 详细信息
- HTTP帖子,无需等待响应
- 问题导致程序停止响应,并且姓氏未正确打印
- AT 命令响应解析器
- 将静态 IP 分配给我的 ESP32 服务器后不再响应
- 用于C++的 TCP/IP 解析器和响应器
- 使用Resiprocate SIP堆栈转发SIP请求/响应