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. 2015第22周六Java反射、泛型、容器简介

    Java的反射非常强大,传递class, 可以动态的生成该类.取得这个类的所有信息,包括里面的属性.方法以及构造函数等,甚至可以取得其父类或父接口里面的内容. obj.getClass().getDe ...

  2. CSS的基本认识

    1.定义: 级联样式表(Cascading Style Sheet)简称“CSS”,通常又称为“风格样式表(Style Sheet)”,它是用来进行网页风格设计的. 2.对CSS的基本认识: CSS是 ...

  3. java 自定义鼠标图标

    由于截图截不了,所以看不了图.源码如下: import java.awt.Cursor; import java.awt.Image; import java.awt.Point; import ja ...

  4. web.xml配置DispatcherServlet

    1. org.springframework.web.servlet.DispatcherServlet 所在jar包: <dependency> <groupId>org.s ...

  5. 菜鸟学EJB(二)——在同一个SessionBean中使用@Remote和@Local

    不废话.直接进入正题: 在Jboss4及曾经的版本号中,例如以下代码能够成功部署: package com.tjb.ejb; import javax.ejb.Local; import javax. ...

  6. OCP-1Z0-051-题目解析-第28题

    28. Which two statements are true regarding constraints? (Choose two.)  A. A foreign key cannot cont ...

  7. 写一个段落python代码推理list深浅

    主要是针对嵌套列表问题. 列表套列表,究竟子列表那个更深... 这个问题想着就烦.假设嵌套10000万个列表是不是要统计10000个数再排序呢? 最后想了想用 list的extend功能 加上递归函数 ...

  8. 解决Fetching android sdk component information加载过久问题

    安装完成后,如果直接启动,Android Studio会去获取 android sdk 组件信息,这个过程相当慢,还经常加载失败,导致Android Studio启动不起开.解决办法就是不去获取and ...

  9. JavaScript 函数方法 - bind()

    Function.prototype.bind() ECMAScript5中新增的方法,但是在ECMAScript3可以通过模仿实现其方法作用 作用: bind() 方法会创建一个新函数,当这个新函数 ...

  10. css设置滚动条颜色与样式以及如何去掉与隐藏滚动条

    我们大家在浏览网页的时偶尔会看到很漂亮的各种颜色样式的滚动条,这就是通过css代码控制来实现的,于是本人搜集整理一番,这里和大家分享一下使用CSS设置滚动条颜色以及如何去掉滚动条的方法,需要的朋友可以 ...