fonoempresa / boghe

Automatically exported from code.google.com/p/boghe
0 stars 0 forks source link

How to get Call-ID when send message in Boghe project ? #170

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Experts,

I see in Boghe project have function to send message :

public bool SendTextMessage(String text, String contentType)
        {
            this.session.addHeader("Content-Type", String.IsNullOrEmpty(contentType) ? ContentType.TEXT_PLAIN : contentType);

            byte[] payload = Encoding.UTF8.GetBytes(text);
            bool ret = this.session.send(payload); 
            return ret;
        }

- ret value is returned by value : true or false. 
I understand that : true value is returned when Boghe core create successfully 
message : SIP MESSAGE , otherwise false value is returned.

I can get Call-ID of reponse message in callback function :
public override int OnMessagingEvent(MessagingEvent e)
            {
                tsip_message_event_type_t type = e.getType();

                switch (type)
                {
                    case tsip_message_event_type_t.tsip_ao_message:
                        SipMessage message1 = e.getSipMessage();
                        String callId = message1.getSipHeaderValue("Call-ID");
....
}
...
    }

I want to get Call-ID when SIP MESSAGE is sent before receiving respond 
message. But I don't know how to get it or what function ?

Or have any way to recognize when I send SIP MESSAGE 1 , I want to know which 
respond message is exactly for MESSAGE 1 not MESSAGE 2 .

* In the other way :I compare 2 sessionId before sending message and after 
receipting callback : 

- When send message : 
bool ret = this.session.send(payload); 
uint sessonId = this.session.getId();  // return sessionId number  ok (example 
: 10,11,...)

- In OnMessageEvent() method 

  public override int OnMessagingEvent(MessagingEvent e)
            {
                tsip_message_event_type_t type = e.getType();

                MessagingSession _session = e.getSession(); // _session = null
                uint _sessionId = _session.getId(); // crash program because : NullReferenceExeption was unhandled.
                switch (type)
                {
....
}
     }

- I view in visual studio output :
*INFO: === MESSAGE Dialog terminated ===
before it is turned to callback method : OnMessageEvent() -> so sessionId in 
this function is receipt null.

--> So I think I can not use sessionId to recognize when I send SIP MESSAGE 1 , 
I want to know which respond message is exactly for MESSAGE 1 not MESSAGE 2 .

So can you tell me how to make it in Boghe source code, please ?

Please answer as soon as possible.
Thank you so much ! 

Rgds.

Original issue reported on code.google.com by banmaixa...@gmail.com on 5 Jan 2013 at 5:03