porting pjsip to a texas instruments DSP using SYSBIOS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So this is a doosey

 

I just want to preface this to say that I am new to SIP and new to pjsip. I am basing all this on pjsip 2.8

 

My goal has 3 parts.

1)      Compile pjsip for my platform

2)      Link the libraries built with our current project

3)      Make a SIP call

 

So I have been tasked to take pjsip and port it to our processor and environment. SYSBIOS is a real time operating system. I have come to realize that pjsip is very much oriented toward linux/unix/windows type systems.  There are a lot of system calls and assumptions that those system have that we do not. Our system is a true embedded system.  We run on custom hardware and we are hand crafted to run on that hardware and that hardware alone. We do not have all the niceties of linux such as built in networking calls, processes, a standard errno, and several other things. A lot of things work differently as well. We do not have processes and threads as you know it and all the standard API that goes with them, and our timers behave differently than a linux system. As a result I can’t run a system that runs a command console with a SIP app, and I can’t really run the test programs very easily.

 

So for starters I downloaded the library and quickly realized I would not be able to run the top Makefile. My solution ended up being breaking the pjsip library into several libraries and compiling them individually, linking files in between them as necessary. In addition I had to make all the os_sysbios.c, sock_sysbios.c, and a couple of other files to fill in blanks and translate things for sleeping, semaphores, timers, clocks, files, mutex’s, and all networking system calls. In addition I had to make a lot of other changes to remove/add the assumptions that this library would be running on either linux or windows. I currently have 6 separate libraries.

·         Pjproject_3rd_party

·         Pjproject_lib

·         pjprojectLib-util

·         pjprojectmedia

·         pjprojectnath

·         pjprojectsip

 

I did get them all to build into the appropriate library files. However, since I am a complete newb to this entire thing I am sure I missed several things that needs to be included/changed that somehow does not break the compiler but still results in a broken system

 

The next step is to take these libraries and link it into my existing project. I created a new Task for the pjsip stuff with a rather large stack. the system waits until we have a DHCP address before this task is released and allowed to run.  I based the code that this stack is running on:

https://www.pjsip.org/pjsip/docs/html/page_pjsip_sample_simple_ua_c.htm

 I tried, originally, to use this example:

https://www.pjsip.org/pjsip/docs/html/page_pjsip_sample_simple_pjsuaua_c.htm

since it is so much simpler, but it requires threads (no matter what you set things for, it always creates a worker thread. There is even code in there for if(worker thread == 0) worker thread = 1)

 

so after modifying it some to be able to run I was finally able to link this in with the libraries and run through the init code without crashing. 

 

I moved on to attempting to make a call. This is where (additional) problems started (not that it was easy to get here). I was able to pass on a SIP URI and the system DOES send out invite packets (confirmed by wireshark), however I also found out that the code does not attempt to register itself with the server. When looking through the code I do not see anywhere where a registration message is actually sent out. all my invite requests are met with 404 not found packets. So I started looking around to see what it would take to get this thing to actually do the account creation/registration. I found the code in the compact project:

 

/* Register to SIP server by creating SIP account. */

156  {

157  pjsua_acc_config cfg;

158

159  pjsua_acc_config_default(&cfg);

160  cfg.id = pj_str("sip:" SIP_USER "@" SIP_DOMAIN);

161  cfg.reg_uri = pj_str("sip:" SIP_DOMAIN);

162  cfg.cred_count = 1;

163  cfg.cred_info[0].realm = pj_str(SIP_DOMAIN);

164  cfg.cred_info[0].scheme = pj_str("digest");

165  cfg.cred_info[0].username = pj_str(SIP_USER);

166  cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;

167  cfg.cred_info[0].data = "">

168

169  status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id);

170  if (status != PJ_SUCCESS) error_exit("Error adding account", status);

171  }

 

But I could not just insert that into my code and be happy. It first of all fails because pjsua_var.tpdata[0].data.ptr is null. So I had to figure out how that gets set. So I added this code which seems to set the data.ptr up for tpdata[0]:

 

/* Add UDP transport. */

142  {

143  pjsua_transport_config cfg;

144

145  pjsua_transport_config_default(&cfg);

146  cfg.port = 5060;

147  status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &cfg, NULL);

148  if (status != PJ_SUCCESS) error_exit("Error creating transport", status);

149  }

 

But then that failed because pjsua_var.endpt is null. I am currently unsure how to set that but I also feel like I am going down a path that I don’t need to. The current set up doesn’t use pjsua_var members to send out the invite and wireshark confirms those are going out. I am unsure how to get this thing to be able to register. I don’t know if I messed something up deep down in the core library or if this example is broken to begin with and it really doesn’t register the device. I also noticed that when it sends out the invite packets it does many retries and gives up, and it is getting a response so it didn’t seem like it was processing any incoming data off the network. I put a breakpoint in the code at pj_sock_recv and pj_sock_recvfrom and neither breakpoint was hit meaning this system is never attempting to receive data from the network stack.

 

I kind of feel like I wandered into the woods and got lost. I am pretty confused as to where to go next with this. This topic seems like it could use a 6 month class to clarify how it works and I am trying to get it to work in a few weeks. It is all very overwhelming. I am not sure if it really is this complex or I am overthinking things or missed a series of API’s/config settings that would have saved me a world of pain.

 

I don’t know what help anyone could provide but anything that can help would be appreciated. Thanks for reading at least.

 

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux