SIP客户端定期向服务器注册

时间:2013-09-12 09:04:28

标签: sip sip-server

我已经编写了一个带有SIP SDK的SIP客户端,您可以上网。经典SIP的东西:您注册SIP服务器,拨打电话,被叫...这样可以正常工作,但假设SIP服务器重新启动或由于其他原因丢失了SIP客户端的注册。现在其他客户端无法呼叫您,因为您在SIP服务器上找不到。

这是如何处理的? 即使您已经注册,您是否定期发送另一个注册消息?每10分钟或类似的事情?你首先取消注册(这意味着在你之间的一段时间内你无法访问,不会很好)然后注册,或者你已经注册时可以调用注册而没有问题吗?

我还发现了寄存器/选项保持活动消息,但我不确定它的用途是什么,它可以处理sip服务器不再注册的情况吗?是否始终由sip-servers支持?

1 个答案:

答案 0 :(得分:3)

在对REGISTER的回复中,您应该获得一个Expires标题(您也可以发送一个标题)。您应该在到期时间之前发送另一个REGISTER请求。这应该让您在典型情况下注册。服务器本身不应该丢失您的注册,即使它重新启动。如果它确实没有持久存储数据那么你就无法做到这一点。您的注册将在下一个到期时间之前刷新。

像往常一样 - 如果有疑问,请阅读the RFC

  

10.3处理注册请求

     

...

7. The registrar now processes each contact address in the Contact
     header field in turn.  For each address, it determines the
     expiration interval as follows:

     -  If the field value has an "expires" parameter, that value
        MUST be taken as the requested expiration.

     -  If there is no such parameter, but the request has an
        Expires header field, that value MUST be taken as the
        requested expiration.

     -  If there is neither, a locally-configured default value MUST
        be taken as the requested expiration.

这部分还应该解释一些事情:10.2.1.1 Setting the Expiration Interval of Contact Addresses