ht2-registration.dox
来自「该文件包含了sip协议的api以及示列的原代码」· DOX 代码 · 共 71 行
DOX
71 行
/** * @ingroup libeXosip2 The eXtented eXosip stack * @defgroup howto2_registration How-To send or update registrations.eXosip2 offers a flexible API to help you to register one or several identities.<H2>Initiate a registration</H2>To start a registration, you need to build a default REGISTER requestbby providing several mandatory headers<PRE> osip_message_t *reg = NULL; int id; int i; eXosip_lock (); id = eXosip_register_build_initial_register (identity, registrar, NULL, 1800, ®); if (id < 0) { eXosip_unlock (); return -1; } osip_message_set_supported (reg, "100rel"); osip_message_set_supported(reg, "path"); i = eXosip_register_send_register (id, reg); eXosip_unlock (); return i;</PRE>The returned element of eXosip_register_build_initial_register is theregistration identifier that you can use to update your registration.In future events about this registration, you'll see that registrationidentifier when applicable.<H2>Update a registration</H2>You just need to reuse the registration identifier:<PRE> int i; eXosip_lock (); i = eXosip_register_build_register (id, 1800, ®); if (i < 0) { eXosip_unlock (); return -1; } eXosip_register_send_register (id, reg); eXosip_unlock ();</PRE><b>Note</b>: The above code also shows that the stack is sometimes able tobuild and send a default SIP messages with only one API call<H2>Closing the registration</H2>A softphone should delete its registration on the SIP server when terminating.To do so, you have to send a REGISTER request with the expires header set tovalue "0".The same code as for updating a registration is used with 0 instead of 1800for the expiration delay.*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?