How to get SIP headers in the application code?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • avc892578805570
    Member
    • Dec 2024
    • 4

    How to get SIP headers in the application code?

    Hi Guys,

    Can you please tell me how to get all the SIP headers on my own in the IVR application?

    I want to do it in the code.

    I know that part or SIP headers goes to session object but I would like to get them in my own code.

    Thanks in advance,
    Vasily.

    PS: I would be very grateful if you help me to change avc892578805570 to the normal nickname.
  • jtb1
    Whiz
    .
    • Feb 2017
    • 33

    #2
    To your second question - please review the related FAQs - https://support.avaya.com/forums/help I am not sure why my handle is what it is and not the autogenerated one, and I dont quickly find the answer you seek - perhaps you can. It may have to do with the level of SSO account you have.

    Comment

    • avc861193901584
      Hot Shot
      • Sep 2024
      • 19

      #3
      For the first question, you can add a Capture Expression to your AppRoot/starting node using an appropriate expression.
      For example, to get custom headers you would use session.connection.protocol.sip.unknownhdr .
      If you wanted to get all SIP information, you could use the expression session.connection.protocol.sip and assign it to a project-defined variable in your AOD application.
      You may need to use a JSON tool or library to properly navigate the data.
      Adam | Swampfox Technologies Inc. | Avaya Partner
      Solutioning in: Avaya Experience Portal | AXP Connect | AES

      Comment

      • wilsonyu
        Hot Shot
        .
        • Sep 2011
        • 24

        #4
        In VXML, you would use the <var name="", expression=""/> element. For example, <var name="sessionSip" expr="try {JSON.stringify(session.connection.protocol.sip)} catch (errMsg) {'undefined'}"/>

        Comment

        • avc892578805570
          Member
          • Dec 2024
          • 4

          #5
          Hi All,
          Just a report according to your hints. And for those who will need to get SIP headers in their projects.
          Yes, it is possible and it is simple.
          According to avc861193901584 the function "Capture Expression" in AppRoot does work well.
          For example, below are the screenshots from my project:
          Click image for larger version

Name:	image.png
Views:	30
Size:	99.2 KB
ID:	48850

          Click image for larger version

Name:	image.png
Views:	33
Size:	97.1 KB
ID:	48851
          And in the trace.log you will see the result.

          Click image for larger version

Name:	image.png
Views:	30
Size:	14.8 KB
ID:	48852

          If you want to set some custom sip header then the best way to do it is to use session.connection.protocol.sip.unknownhdr. (In the OD UG you can find the guide how to do it).

          The recommendation from wilsonyu does work well as well.
          In VXML, you would use the <var name="", expression=""/> element. For example, <var name="sessionSip" expr="try {JSON.stringify(session.connection.protocol.sip)} catch (errMsg) {'undefined'}"/>

          Thanks,
          Vasily.

          Comment

          Loading