Pages

Tuesday 13 November 2012

Difference between SIP REFER and (RE)INVITE

What is this and when it is used? When I started working in SIP environment, it was confusing to me, as well.

But after reading RFC3261, it became clear to me. Simply said, REFER method is used for transferring a call and INVITE is used to change session media information.

Refer to the example below to understand it more clearly.

REFER – Example


Suppose Alice and Bob are on call and Alice wants to transfer call to Carol, Alice will send REFER to Bob with Carol information.
Transfer-Unattended
REFER sips:bob@client.biloxi.example.com SIP/2.0
Via: SIP/2.0/TLS client.biloxi.example.com:506;branch=z9hG4bKnashds8
Max-Forwards: 70
From: Alice <sips:alice@atlanta.example.com>;tag=1234567
To: Bob <sips:bob@biloxi.example.com>;tag=314159
Call-ID:
12345601@atlanta.example.com
CSeq
: 101 REFER
Refer-To: <sips:carol@chicago.example.com>
Referred-By: <alice@atlanta.example.com>

Contact: <sips:alice@client.atlanta.example.com>
Content-Length: 0
(RE)INVITE – Example 



If Bob wants to session media information, then INVITE is sent again with updated information. Consider, call on hold as an example for this.

In this scenario, Alice calls Bob, then Bob places the call on hold.Bob then takes the call off hold, then Alice hangs up the call.


           Call Hold

F1 INVITE Alice -> Proxy 1

      INVITE sips:bob@biloxi.example.com SIP/2.0
      Via: SIP/2.0/TLS client.atlanta.example.com:5061;branch=z9hG4bK74bf9
      Max-Forwards: 70
      From: Alice <sips:alice@atlanta.example.com>;tag=1234567
      To: Bob <sips:bob@biloxi.example.com>
      Call-ID: 12345601@atlanta.example.com
      CSeq: 1 INVITE
      Contact: <sips:alice@client.atlanta.example.com>
      Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
      Supported: replaces
      Content-Type: application/sdp
      Content-Length: ...

      v=0
      o=alice 2890844526 2890844526 IN IP4 client.atlanta.example.com
      s=
      c=IN IP4 client.atlanta.example.com
      t=0 0
      m=audio 49170 RTP/AVP 0
      a=rtpmap:0 PCMU/8000

F10 INVITE Bob -> Proxy 1
      INVITE sips:alice@client.atlanta.example.com SIP/2.0
Via: SIP/2.0/TLS client.biloxi.example.com:5061;branch=z9hG4bKnashds7
Route: <sips:ss1.example.com;lr>
Max-Forwards: 70
From: Bob <sips:bob@biloxi.example.com>;tag=314159
To: Alice <sips:alice@atlanta.example.com>;tag=1234567
Call-ID: 12345601@atlanta.example.com
CSeq: 1 INVITE
Contact: <sips:bob@client.biloxi.example.com>;+sip.rendering="no"
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: ...

v=0
o=bob 2890844527 2890844528 IN IP4 client.biloxi.example.com
s=
c=IN IP4 client.biloxi.example.com
t=0 0
m=audio 3456 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=sendonly

Here, you can see Bob changed SDP session attribute as ‘sendonly’ to place the call on hold and to retrieve the call, this will be changed to ‘sendrecv’.

How to enable logging in Genesys Administrator?

 

Genesys Administrator tracing can be enabled by changing the following in the <log4net> section (of Web.Config):

<log4net>
        <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
            <file value="logfile"/>
            <appendToFile value="true"/>
            <rollingStyle value="Composite"/>
            <datePattern value="yyyyMMdd"/>
            <!-- gst: append following to add .txt to file name:  .\\tx\\t -->
            <maxSizeRollBackups value="10"/>
            <maximumFileSize value="1MB"/>
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"/>
            </layout>
        </appender>
        <!-- gst added -->
        <appender name="TraceAppender" type="log4net.Appender.TraceAppender">
            <layout type="log4net.Layout.PatternLayout">
                <!--ConversionPattern value="%d [%t] %-5p %c - %m [%P{InstanceId}]%n" / -->
                <ConversionPattern value="%message%newline"/>
            </layout>
        </appender>

<root>
   <level value="INFO"/>    
  <!-- appender-ref ref="RollingLogFileAppender"/ -->
   <appender-ref ref="TraceAppender"/>
  </root>

to:

<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="galog.log"/>
<appendToFile value="true"/>
<rollingStyle value="Composite"/>
<datePattern value="yyyyMMdd"/>
<!-- gst: append following to add .txt to file name: .\\tx\\t -->
<maxSizeRollBackups value="10"/>
<maximumFileSize value="1MB"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"/>
</layout>
</appender>
<!-- gst added -->
<appender name="TraceAppender" type="log4net.Appender.TraceAppender">
<layout type="log4net.Layout.PatternLayout">
<!--ConversionPattern value="%d [%t] %-5p %c - %m [%P{InstanceId}]%n" / -->
<ConversionPattern value="%message%newline"/>
</layout>
</appender>

  <root>
   <level value="DEBUG"/>
   <appender-ref ref="RollingLogFileAppender"/>

   <appender-ref ref="TraceAppender"/>
  </root>

For the above changes to take effect, you need to logout and login. You can now see file “galog.log” will be created in the same installation path as Genesys Administrator