한국어

소프트스위치

온누리070 플레이스토어 다운로드
    acrobits softphone
     온누리 070 카카오 프러스 친구추가온누리 070 카카오 프러스 친구추가친추
     카카오톡 채팅 상담 카카오톡 채팅 상담카톡
    
     라인상담
     라인으로 공유

     페북공유

   ◎위챗 : speedseoul


  
     PAYPAL
     
     PRICE
     

pixel.gif

    before pay call 0088 from app


https://blog.opensips.org/2017/03/10/advanced-sip-scenarios-with-event-based-routing/


Advanced SIP scenarios with Event-based-Routing


  • Push Notification (call and registration correlation)
  • Call Pickup (2 calls correlation)
  • DMTF/IVR call driving (call and RTP correlation)

There is an increasing need for more complex SIP scenarios, even for the Class 4 Switches. Such scenarios exceed the capabilities of a liner processing – something more powerful and flexible is needed in turns of driving the SIP routing.

The 2.1 OpenSIPS version brought a radical change in how the SIP traffic is handled – a more efficient processing and a better CPU harvesting were achieved by introducing the asynchronous (or non blocking) I/O operations.

Even if the performance and responsiveness of OpenSIPS was addressed, the handling (or processing) of the SIP messages is still linear. Once you start processing a SIP message you can do external queries (DB, REST, Exec and other), but it is limited to its own context, being unable to:

  • communicate and exchange data with the processing of a different SIP message
  • synchronize or wait for  actions related to the processing of a different SIP message

Such capabilities are essential in order to implement more complex SIP scenarios where multiple elements (calls, registrations, RTP events, B2B sessions) are involved and correlated at different moments in time. And some examples of such scenarios:

  • Push Notification (call and registration correlation)
  • Call Pickup (2 calls correlation)
  • DMTF/IVR call driving (call and RTP correlation)

and many more.

Event based Routing

This is the way of performing SIP routing via events (generated by the Event Interface).  And this is a new mechanism provided by OpenSIPS 2.3 to address complex processing problems.

But what are these events ?

  • Triggered by actions / data processing during runtime  – like a new contact is registered, a destination is marked as failed, a dialog ended – all are events;
  • The events hold key/value attributes – these attributes are describing the event and they represent the data attached to the event;
  • OpenSIPS has a list of events – the events are predefined (by modules) or custom defined in the OpenSIPS script.

Now, how are these events used to control the SIP routing ? The OpenSIPS 2.3 Event based Routing (or shortly EBR) relays on a subscriber – notify model :

  • when processing a SIP message, you can subscribe to certain events;
  • the event subscriptions may contain filtering attributes (to narrow down the interesting events);
  • when an event is raised, it is dispatched to all relevant subscribers- this is the notification part.

And finally, how does the routing part work ?

  • The subscriber waits in asynchronous  mode to receive the notification; the processing of the subscriber will suspend and it will be fully resumed when the notification is
    received.EBR_model_wait
  • The subscriber continues its processing after subscription, without any waiting. Whenever a notification is received, a script route (armed by the subscription) will be executed.EBR_model_notify

Example time – Push Notification

Scenario

Alice calls Bob. Bob has a hardphone registered, but he may also use a mobile device as SIP client. The SIP client on the mobile device is not permanently SIP registered, and it requires a Push Notification (or similar) mechanism to force its registration when there is an incoming call.

Challenges

  • we want to deliver the call right away to Bob’s hardphone, without any waiting due the PN logic.
  • we want to do parallel forking (simultaneous ringing) to Bob’s mobile, as soon as it registers (as a result of PN)
  • we want to keep the call on, even if the hardphone declines it (maybe due to DND settings) and give a chance to the PN to trigger the mobile device registration.

If we manage to address all the challenges above, we can say we have a fully flavored Push Notification implementation.

How to

When we route the call to the callee – to Bob, in our case – we need to follow these logical steps:

  1. subscribe for the event to let us know when there is a new contact registered by Bob
  2. fetch all existing registered contacts from user-location
  3. if any contacts found, send the call to the existing contacts
  4. when new contact events are notified, inject them into the call to Bob

OpenSIPS script

Here is the relevant OpenSIPS script doing the above . For a better understanding of the code and used functions, I strongly recommend to read the module documentation for the event_routing and tm modules.

route[route_to_user] {

    # prepare transaction for branch injection; it is mandatory
    # to create the transaction before the subscription, otherwise
    # the EBR module will not pass the transaction ID into the
    # notification route
    t_newtran();

    # keep the transaction alive (even if all branches will
    # terminate) until the FR INVITE timer hits (we want to wait
    # for new possible contacts being registered)
    t_wait_for_new_branches();

    # subscribe to new contact registration event, but for our callee only
    $avp(filter) = "aor="+$rU;
    notify_on_event("E_UL_CONTACT_INSERT","$avp(filter)", "fork_call", "20");

    # fetch already registered contacts and relay if any
    if (lookup("location"))
        route(relay);
    # if there were no contacts available (so no branches created so far),
    # the created transaction will still be waiting for new branches due 
    # to the usage of the t_wait_for_new_branches() function

    exit;
}

route[fork_call]  {
    xlog("user $avp(aor) registered the a new contact $avp(uri), "
        "injecting it in transaction\n");
    # take the contact described by the E_UL_CONTACT_INSERT
    # event and inject it as a new branch into the original transaction
    t_inject_branches("event");
}

Do you want to see this script in action ? We uploaded a demo recording on youtube, just for you to enjoy it <div class=이 게시물을...

조회 수 :
37208
등록일 :
2017.09.11
19:29:22 (*.160.88.18)
엮인글 :
http://webs.co.kr/index.php?document_srl=3311864&act=trackback&key=c28
게시글 주소 :
http://webs.co.kr/index.php?document_srl=3311864
List of Articles
번호 제목 글쓴이 조회 수 추천 수 날짜
142 OpenSIPS Module Interface admin 48134   2017-12-07
 
141 opensips configuration config explain easy basic 오픈쉽스 컨피그레이션 기본 설명 file admin 28013   2017-12-07
 
140 openssl 을 이용한 인증서 생성 절차를 정리한다. 개인키 CSR SSL 인증서 파일 생성 admin 28490   2017-09-14
 
139 Documentation -> Tutorials -> TLS opensips.cfg admin 29217   2017-09-14
 
138 Using TLS in OpenSIPS v2.2.x admin 49609   2017-09-14
 
137 opensips tls cfg admin 34192   2017-09-14
 
136 How to setup a Jabber / XMPP server on Debian 8 (jessie) using ejabberd admin 130158   2017-09-13
 
135 SIP to XMPP Gateway + SIP Presence Server opensips admin 56533   2017-09-13
 
134 OpenSIPS command line tricks admin 49531   2017-09-13
 
133 Fail2Ban Freeswitch How to secure admin 65881   2017-09-12
 
132 opensips.cfg. sample admin 27880   2017-09-12
 
» Advanced SIP scenarios with Event-based-Routing admin 37208   2017-09-11
https://blog.opensips.org/2017/03/10/advanced-sip-scenarios-with-event-based-routing/ Advanced SIP scenarios with Event-based-Routing Push Notification (call and registration correlation) Call Pickup (2 calls correlat...  
130 PUSH SERVER 푸시서버 안드로이드 애플 admin 217140   2017-09-11
 
129 오픈소스 (사내)메신저 서버 구축, 오픈 파이어(openfire) 설치방법과 세팅(리눅스 기준) admin 79413   2017-09-09
 
128 rtpengine config basic and opensips configuration and command admin 58487   2017-09-06
 
127 WebSocket Transport using OpenSIPS configuration 웹 소켓 컨피그레이션 기본 admin 24947   2017-09-06
 
126 OpenSIPS basic configuration script 기본 컨피그 admin 111357   2017-09-05
 
125 rtpengine install and config admin 62369   2017-09-05
 
124 Installing RTPEngine on Ubuntu 14.04 admin 35724   2017-09-05
 
123 compile only the textops module make modules=modules/textops modules admin 23435   2017-09-05
 
122 opensips command /sbin/opensipsctl detail admin 131141   2017-09-04
 
121 2017 08 31 opensips 2.32 install debian8.8 module install compile err modules admin 46830   2017-09-04
 
120 Build-Depends debian 8.8 opensips 2.3 admin 68741   2017-09-04
 
119 What is new in 2.3.0 opensips admin 253493   2017-09-04
 
118 ubuntu 安装配置opensips,rtpproxy,mediaproxy admin 27490   2017-09-04
 
117 How to install Mediaproxy 2.5.2 on CentOS 6 64 bit admin 149709   2017-09-04
 
116 Using TLS in OpenSIPS v2.2.x configuration admin 50891   2017-09-04
 
115 How to 2.3 download , OpenSIPS new apt repository. DEBs for Debian / Ubuntu admin 23057   2017-09-02
 
114 You can install CDRTool in the following ways: admin 24276   2017-09-01
 
113 How to Install OpenSIPS 2.1.2 Server on Ubuntu 15.04 admin 30121   2017-09-01