RFC4235 on Dialog Event Packages: - To estalish a subscription to a specific dialog the call-id, to-tag and from-tag must be specified, - To establish a subscription to a set of dialogs the call-id and to-tag must be specified. Treatment of the Event header: - If the Event header contains dialog identifiers a notification is sent for any dialogs that match them AND the user in the SUBSCRIBE URI. - If the Event header does not contain any dialog identifiers then a notification is sent for every dialog that matches the user in the SUBSCRIBE URI. - Notifications contain the identities of the dialog participants, the target URIs and the dialog identifiers. - The format of the NOTIFY bodies must be in a format specified in a SUBSCRIBE Accept header or if omitted a default format of "application/dialog-info+xml". Example of an empty dialog notification body: Example of a single entry dialog notification body: terminated 145
Inheritance: SIPSorcery.SIP.SIPEvent
Ejemplo n.º 1
0
            public void ParseFromXMLStringMultiDialogsUnitTest()
            {
                Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

                string eventDialogInfoStr = "<?xml version='1.0' encoding='utf-16'?>" +
                                            "<dialog-info version='1' state='full' entity='sip:[email protected]' xmlns='urn:ietf:params:xml:ns:dialog-info'>" +
                                            " <dialog id='as7d900as8' call-id='a84b4c76e66710' local-tag='1928301774' direction='initiator'>" +
                                            "  <state event='remote-bye' code='486'>terminated</state>" +
                                            "  <duration>13</duration>" +
                                            " </dialog>" +
                                            " <dialog id='4353458'>" +
                                            "  <state>progressing</state>" +
                                            " </dialog>" +
                                            "</dialog-info>";

                SIPEventDialogInfo dialogInfo = SIPEventDialogInfo.Parse(eventDialogInfoStr);

                Assert.IsTrue(dialogInfo.DialogItems.Count == 2, "The parsed event dialog items count was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].ID == "as7d900as8", "The parsed event dialog event id for the first dialog was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].State == "terminated", "The parsed event dialog event state for the first dialog was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[1].ID == "4353458", "The parsed event dialog event id for the second dialog was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[1].State == "progressing", "The parsed event dialog event state for the second dialog was incorrect.");

                Console.WriteLine(dialogInfo.ToXMLText());

                Console.WriteLine("-----------------------------------------");
            }
Ejemplo n.º 2
0
        public static SIPEventDialogInfo Parse(string dialogInfoXMLStr)
        {
            SIPEventDialogInfo eventDialogInfo = new SIPEventDialogInfo();

            eventDialogInfo.Load(dialogInfoXMLStr);
            return(eventDialogInfo);
        }
Ejemplo n.º 3
0
            public void ParseFromXMLStringUnitTest()
            {
                Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

                string eventDialogInfoStr = "<?xml version='1.0' encoding='utf-16'?>" +
                                            "<dialog-info version='1' state='full' entity='sip:[email protected]' xmlns='urn:ietf:params:xml:ns:dialog-info'>" +
                                            " <dialog id='as7d900as8' call-id='a84b4c76e66710' local-tag='1928301774' direction='initiator'>" +
                                            "  <state event='remote-bye' code='486'>terminated</state>" +
                                            "  <duration>13</duration>" +
                                            " </dialog>" +
                                            "</dialog-info>";

                SIPEventDialogInfo dialogInfo = SIPEventDialogInfo.Parse(eventDialogInfoStr);

                Assert.IsTrue(dialogInfo.Version == 1, "The parsed event dialog version was incorrect.");
                Assert.IsTrue(dialogInfo.State == SIPEventDialogInfoStateEnum.full, "The parsed event dialog state was incorrect.");
                Assert.IsTrue(dialogInfo.Entity == SIPURI.ParseSIPURI("sip:[email protected]"), "The parsed event dialog entity was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems.Count == 1, "The parsed event dialog items count was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].ID == "as7d900as8", "The parsed event dialog event id was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].CallID == "a84b4c76e66710", "The parsed event dialog event call-id was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].LocalTag == "1928301774", "The parsed event dialog event local-tag was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].Direction == SIPEventDialogDirectionEnum.initiator, "The parsed event dialog event direction was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].State == "terminated", "The parsed event dialog event state was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].StateEvent == SIPEventDialogStateEvent.RemoteBye, "The parsed event dialog event state event was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].StateCode == 486, "The parsed event dialog event state code was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].Duration == 13, "The parsed event dialog event duration was incorrect.");

                Console.WriteLine("-----------------------------------------");
            }
Ejemplo n.º 4
0
            public void GetAsXMLStringUnitTest()
            {
                Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

                SIPEventDialogInfo dialogInfo = new SIPEventDialogInfo(0, SIPEventDialogInfoStateEnum.full, SIPURI.ParseSIPURI("sip:[email protected]"));

                dialogInfo.DialogItems.Add(new SIPEventDialog("abcde", "terminated", 487, SIPEventDialogStateEvent.Cancelled, 2));

                Console.WriteLine(dialogInfo.ToXMLText());

                Console.WriteLine("-----------------------------------------");
            }
Ejemplo n.º 5
0
            public void ParseFromXMLStringDialogWithParticipantsUnitTest()
            {
                Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

                string eventDialogInfoStr = "<?xml version='1.0' encoding='utf-16'?>" +
                                            "<dialog-info version='1' state='full' entity='sip:[email protected]' xmlns='urn:ietf:params:xml:ns:dialog-info'>" +
                                            " <dialog id='as7d900as8' call-id='a84b4c76e66710' local-tag='1928301774' direction='initiator'>" +
                                            "  <state event='remote-bye' code='486'>terminated</state>" +
                                            "  <duration>13</duration>" +
                                            "  <local>" +
                                            "   <identity>sip:[email protected];user=phone</identity>" +
                                            "   <cseq>2</cseq>" +
                                            "  </local>" +
                                            "  <remote>" +
                                            "   <identity display-name='Joe Bloggs'>sip:[email protected]</identity>" +
                                            "   <target uri='sip:[email protected]:5070' />" +
                                            "   <cseq>1</cseq>" +
                                            "  </remote>" +
                                            " </dialog>" +
                                            "</dialog-info>";

                SIPEventDialogInfo dialogInfo = SIPEventDialogInfo.Parse(eventDialogInfoStr);

                Assert.NotNull(dialogInfo.DialogItems[0].LocalParticipant, "The parsed event dialog local participant was not correct.");
                Assert.NotNull(dialogInfo.DialogItems[0].RemoteParticipant, "The parsed event dialog remote participant was not correct.");
                Assert.IsTrue(dialogInfo.DialogItems[0].LocalParticipant.URI == SIPURI.ParseSIPURI("sip:[email protected];user=phone"), "The local participant URI was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].LocalParticipant.CSeq == 2, "The local participant CSeq was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].RemoteParticipant.URI == SIPURI.ParseSIPURI("sip:[email protected]"), "The remote participant URI was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].RemoteParticipant.DisplayName == "Joe Bloggs", "The remote participant display name was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].RemoteParticipant.TargetURI == SIPURI.ParseSIPURI("sip:[email protected]:5070"), "The remote participant target URI was incorrect.");
                Assert.IsTrue(dialogInfo.DialogItems[0].RemoteParticipant.CSeq == 1, "The remote participant CSeq was incorrect.");

                Console.WriteLine(dialogInfo.ToXMLText());

                Console.WriteLine("-----------------------------------------");
            }
            public void GetAsXMLStringUnitTest()
            {
                Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

                SIPEventDialogInfo dialogInfo = new SIPEventDialogInfo(0, SIPEventDialogInfoStateEnum.full, SIPURI.ParseSIPURI("sip:[email protected]"));
                dialogInfo.DialogItems.Add(new SIPEventDialog("abcde", "terminated", 487, SIPEventDialogStateEvent.Cancelled, 2));

                Console.WriteLine(dialogInfo.ToXMLText());

                Console.WriteLine("-----------------------------------------");
            }
 public static SIPEventDialogInfo Parse(string dialogInfoXMLStr)
 {
    SIPEventDialogInfo eventDialogInfo = new SIPEventDialogInfo();
    eventDialogInfo.Load(dialogInfoXMLStr);
    return eventDialogInfo;
 }