How-To send or update registrations.

The eXtented eXosip stack

Initiate a registration

To start a registration, you need to build a default REGISTER request by providing several mandatory headers.

You can start as many registration you want even in one eXosip_t context.

osip_message_t *reg = NULL;

int rid;

int i;

eXosip_lock (ctx);

rid = eXosip_register_build_initial_register (ctx, "sip:me@sip.antisip.com", "sip.antisip.com", NULL, 1800, &reg);

if (rid < 0)

{

eXosip_unlock (ctx);

return -1;

}

osip_message_set_supported (reg, "100rel");

osip_message_set_supported (reg, "path");

i = eXosip_register_send_register (ctx, rid, reg);

eXosip_unlock (ctx);

return i;

The returned element of eXosip_register_build_initial_register is the registration identifier that you can use to update your registration. In future events about this registration, you'll see that registration identifier when applicable.

Contact headers in REGISTER

You should let eXosip2 manage contact headers alone. The setup you have provided will generate various behavior, all being controlled by eXosip2. See the "NAT and Contact header" section in setup documentation.

Set password(s)!

Usually, you will need a login/password to access a service!

eXosip can be used to access several service at the same time and thus the realm (identify the service) needs to be provided if you are using several services in the same instance.

The simple way when you use one service with username being the same as the login:

eXosip_lock (ctx);

eXosip_add_authentication_info (ctx, login, login, passwd, NULL, NULL);

eXosip_unlock (ctx);

OR the complete way:

eXosip_lock (ctx);

eXosip_add_authentication_info (ctx, login, login, passwd, NULL, "sip.antisip.com");

eXosip_add_authentication_info (ctx, from_username, login, passwd, NULL, "otherservice.com");

eXosip_unlock (ctx);

Delete all registration

This feature is not advised by sip specification, but it exists for some purpose & reasons! You can send "*" in Contact header of a REGISTER to ask for immediate removal of all active registrations for a particular SIP agent:

rid = eXosip_register_build_initial_register (ctx, "sip:me@sip.antisip.com", "sip.antisip.com", "*", 1800, &reg);

Update a registration

You just need to reuse the registration identifier:

int i;

eXosip_lock (ctx);

i = eXosip_register_build_register (ctx, rid, 1800, &reg);

if (i < 0)

{

eXosip_unlock (ctx);

return -1;

}

eXosip_register_send_register (ctx, rid, reg);

eXosip_unlock (ctx);

Note: The above code also shows that the stack is sometimes able to build and send a default SIP messages with only one API call

Closing the registration

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 to value "0".

The same code as for updating a registration is used with 0 instead of 1800 for the expiration delay.

int i;

eXosip_lock (ctx);

i = eXosip_register_build_register (ctx, rid, 0, &reg);

if (i < 0)

{

eXosip_unlock (ctx);

return -1;

}

eXosip_register_send_register (ctx, rid, reg);

eXosip_unlock (ctx);

Discard registration context

If you need to delete a context without sending a REGISTER with expires 0, you can use eXosip_register_remove to release memory.

int i;

eXosip_lock (ctx);

i = eXosip_register_remove (ctx, rid);

if (i == 0) {

}

eXosip_unlock (ctx);


libeXosip2(1-3) -- How-To send or update registrations.的更多相关文章

  1. libeXosip2(1) -- Modules

    Modules Here is a list of all modules: [detail level 12] The eXtented eXosip stack LibeXosip2 Versio ...

  2. Simple GB28181 System

    I. Deployment  / Architecture Block Diagram II. Resources Used 1. freeswitch —— sip server and media ...

  3. MapReduce剖析笔记之七:Child子进程处理Map和Reduce任务的主要流程

    在上一节我们分析了TaskTracker如何对JobTracker分配过来的任务进行初始化,并创建各类JVM启动所需的信息,最终创建JVM的整个过程,本节我们继续来看,JVM启动后,执行的是Child ...

  4. [翻译]:怎样从C/C++代码中对C#进行回调

    声明:网络上类似的中文博客大有存在,本人知识水平有限,业余爱好,也是为了备份收藏How to make a callback to C# from C/C++ code 本着共享知识的初衷,翻译一份给 ...

  5. Propagation of Visual Entity Properties Under Bandwidth Constraints

    1. Introduction The Saga of Ryzom is a persistent massively-multiplayer online game (MMORPG) release ...

  6. iOS 10.0 更新点(开发者视角)

    html, body {overflow-x: initial !important;}html { font-size: 14px; } body { margin: 0px; padding: 0 ...

  7. 从svn服务器自动同步到另一台服务器

    需求场景 A commit B post-commit C (workstation) --------------> (svn server) ---------------------> ...

  8. Android Non-UI to UI Thread Communications(Part 1 of 5)

    original:http://www.intertech.com/Blog/android-non-ui-to-ui-thread-communications-part-1-of-5/ ANDRO ...

  9. Doubango ims 框架 分析之 多媒体部分

    序言 RTP提供带有实时特性的端对端数据传输服务,传输的数据如:交互式的音频和视频.那些服务包括有效载荷类型定义,序列号,时间戳和传输监测控制.应用程序在UDP上运行RTP来使用它的多路技术和chec ...

随机推荐

  1. 2014.7.8模拟赛【笨笨当粉刷匠】|bzoj1296 [SCOI]粉刷匠

    笨笨太好玩了,农田荒芜了,彩奖用光了,笨笨只好到处找工作,笨笨找到了一份粉刷匠的工作.笨笨有n条木板需要被粉刷.每条木板被分成m个格子,每个格子要被刷成红色或蓝色.笨笨每次粉刷,只能选择一条木板上一段 ...

  2. JPA字段映射(uuid,日期,枚举,@Lob)

    转:http://www.cnblogs.com/tazi/archive/2012/01/04/2311588.html 主键: JPA主键的生成策略不像Hibernate那么丰富. @Id @Ge ...

  3. python - XML文件及其操作

    xml文件也是实现不同语言或者程序之间进行数据交换的协议,它的特点是尖括号开头,尖括号结尾.使用范围就更为广泛了,tomcat resin kvm 等等,使用了大量的xml文件来进行相关配置.先来看一 ...

  4. eclipse 404以及tomcat failed to start错误

    eclipse中的servlet项目有时会不编译,不编译可能就会出现404错误,因为在build path的输出目录并没有class文件,然而如果在输出目录引入之前编译的class文件,就可能出现cl ...

  5. 私人C#笔记

      coust 定义常量 string是密封类,所以不能继承它 namespace默认是按照文件夹的结构命名的,如(System.文件夹.子文件夹),而且namespace是可以手动改的   Arra ...

  6. update-database时出现Cannot attach the file

    在进行Migrations时,如果直接删除了Db文件,在使用update-database时会出现Cannot attach the file发问题 解决方案:

  7. (转)log4net使用详解

    说明:本程序演示如何利用log4net记录程序日志信息.log4net是一个功能著名的开源日志记录组件.利用log4net可以方便地将日志信息记录到文件.控制台.Windows事件日志和数据库(包括M ...

  8. wcf wpf

    转 http://blog.csdn.net/thunder09/article/details/5792157 WPF就是所谓下一代Windows界面层技术,我觉得还有满有前途的.不过Vista发布 ...

  9. SDWebImage实现原理详解

    1)当需要获取网络图片的时候,我们首先需要的便是URL,如果没有URL什么都没有,获得URL后,SDWebImage实现的并不是直接去请求网路,而是检查图片缓存中有没有和URL相关的图片,如果有则直接 ...

  10. arry()数组的理解及api的使用(二)

    注意:本文都来自于w3school中文网,如果需要完整版请去--http://www.w3school.com.cn/jsref/jsref_obj_array.asp 1.1 slice() 方法- ...