I had nothing else to do so I've integrated SipPimClient from 
sipxtacklib into sipxtapi.

Although I still think this messaging is useless most of the time, its 
good for experimenting.

I don't like bad solutions of using internal functions/classes of 
libraries so I decided to integrate sippimclient into sipxtapi. It 
basically creates an instance in sipxtapi initialization, starts the 
OsServerTask, registers a new event handler which is defined in 
sipxtapievents.cpp. You dont need to register any new event handlers, it 
works with the standard sipxtapi event handler. I have added code for 
printing event, duplicating, freeing event. There is new event category 
- EVENT_CATEGORY_PIM, which has its specific event data. All event data 
is only basic C datatypes, no UtlString or anything like that. The event 
data contains event enum, which is currently only PIM_INCOMING_MESSAGE. 
There is SIPX_PIM_INFO struct, which contains the message details.
During sipxuninitialize, the OsServerTask of sippimclient is shutdown 
and deleted. I have modified SipPimClient a little bit so it also 
removes message observer from SipUserAgent in destructor, and limited 
the number of iterations in internal loop of sendPagerMessage to 2. It's 
not right to have infinite loops in any function.

To send a message you call new function in sipxtapi - 
sipxPIMSendPagerMessage. The presentityAor of SipPimClient is set to 
szIdentity parameter of sipxInitialize.

I also found a memory leak in sipxtapievents.cpp - in 
sipxFireKeepaliveEvent memory after strdup is not freed. It has to be 
freed there, the callback function (which is always only 1 - 
SipXEventDispatcher) just makes a copy and frees its own copy.

So far I haven't had any crashes when using this sippimclient, but it 
doesn't succeed in delivering message if I use a certain sip proxy. I 
get 404 Not found response from sip proxy. If I dial the same sip uri it 
works, but sending message to the same uri doesnt. I have tried to send 
message to sip:myipaddress and it sent message to myself, I have 
received my new event type.

Jaroslav Libak

_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to