[pjsip] Integrating PJSIP into Mozilla Framework

Benny Prijono bennylp at pjsip.org
Fri Feb 22 03:54:39 EST 2008


On 2/21/08, Adeyeye O. Michael <micadeyeye at crg.ee.uct.ac.za> wrote:
> Hi Benny,
>  I was able to integrate the SIP stack into Mozilla FF(firefox) by making
>  shared lib. of it and loading into FF using a stub.
>  I have quite a number of shared lib. such as libpjsipregister.so,
>  libpjsipsendim.so, libpjsipreceiveim.so and so on.
>

I'm not sure why we need to create one library for each function (!),
that sounds like bad packaging to me, but then again I'm clueless
about Mozilla framework or HTTP mobility, so maybe this is something
that's enforced by the framework.

>  In one of my shared lib. (libpjsipregister.so), I cloned the result
>  after receiving IM since pjsip_rx_data will be reset after the all
>  callback s are executed. I read that I can't pass pjsip_rx_data
>  structure to another thread for asynchronous processing. So I have
>  something like this:
>
>  static void on_pager(...){
>                 ....
>                 ....
>                 pjsip_msg_body* cloned_msg = &pjsip_msg_body_clone;
>                 ....
>                 ....
>           }
>

If you want to clone a message body, then the above snippet won't do
it. Use this instead:

{
  pjsip_rx_data *rdata;
  pjsip_msg *msg;
  char dup[1500];
  int dup_len;

  // retrieve rdata from pjsip_event
  // see http://trac.pjsip.org/repos/wiki/FAQ#pjsip_event
  rdata = ...
  msg = rdata->msg_info.msg;

  // extract text representation of message body to "dup"
  dup_len = pjsip_print_text_body(msg->body, dup, sizeof(dup));
}

I'm not sure who are your supposed to communicate the cloned body to
another XPCOM or whatever mechanism that you use, so I can't comment
on your snippet below. But lets start with having correct message body
content by using my snippet above first.

cheers,
 -benny

>  In another shared lib.(libpjsipreceiveim.so), I tried to retrieve the
>  data sent in the IM session, basically HTTP URL. I have something like this:
>
>  char *sipreceiveimonly(){
>                 pj_thread_desc desc;
>                 pj_thread_t *thread;
>                 ....
>                 ....
>                 pjsip_msg_body* cloned_msg;
>
>                 return cloned_msg->data;
>                                      }
>
>  The returned values are passed to my XPCOMs in FF which implement those
>  shared lib.
>
>  The problem is that I couldn't retrieve the URL(I guess it's in
>  "cloned_msg->data") on calling *sipreceiveimonly(). This is a
>  provisional solution, I planned to pass such info via SIP INFO rather
>  than IM in the nearest future.
>
>
>  How can I retrieve the IM data (i.e.URL)??
>  Guess I am missing something.
>
>  Yours,
>  Mike.
>
> Benny Prijono wrote:
>  > On 2/19/08, Adeyeye Oluwasegun Michael <micadeyeye at crg.ee.uct.ac.za> wrote:
>  >
>  >> Hi Benny,
>  >> I am currently integrating PJSIP into Mozilla Firefox in order to achieve
>  >> HTTP Session Mobility using SIP. My research intention is to transfer web
>  >> sessions between web browsers using SIP. Though I planned sending the
>  >> data(contents of cookies, rewritten URL, hidden element) via SIP INFO, at
>  >> present, I am sending the data as IM(Instant Messaging).
>  >>
>  >>
>  >
>  > Hi Adeyeye,
>  >
>  > Interesting! I didn't know that we can use SIP for that.
>  >
>  >
>  >> While I have accomplished the task of transferring URL from a browser's
>  >> addressbar to another as IM data using pjsua_im_send(), I haven't been
>  >> able to retrieve the data at the destination browser. I wish you had a
>  >> function like pjsua_im_send() that can help retrieve such data. I tried
>  >> couple of things such as trying to implement the callback, getting value
>  >> of "msg" attribute in the IM message struct pjsua_msg_data/pjsip_rx_data
>  >> but all were futile.
>  >>
>  >
>  > Sorry I don't quite get you. Did you want to retrieve a particular
>  > message element (such as header or message body) from an incoming IM?
>  > Will this help: http://trac.pjsip.org/repos/wiki/FAQ#pjsip_event ?
>  >
>  > cheers,
>  >  -benny
>  >
>  >
>  >
>  >> Do you know if such data is stored in variable not listed in the PJSUA
>  >> module/API?
>  >>
>  >> Your contributions are welcome.
>  >>
>  >> Mike.
>  >>
>  >>
>  >> _______________________________________________
>  >> Visit our blog: http://blog.pjsip.org
>  >>
>  >> pjsip mailing list
>  >> pjsip at lists.pjsip.org
>  >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>  >>
>  >>
>  >
>  > _______________________________________________
>  > Visit our blog: http://blog.pjsip.org
>  >
>  > pjsip mailing list
>  > pjsip at lists.pjsip.org
>  > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>  >
>
>
>  _______________________________________________
>  Visit our blog: http://blog.pjsip.org
>
>  pjsip mailing list
>  pjsip at lists.pjsip.org
>  http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>




More information about the pjsip mailing list