Sending message to other sip client .Urgent!!

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

 



  Hello  Mr srivatsan,

       I am sending the message in  this  format

        TUint8 url[256];
                    TPtr8 aUrl(url, 256);
                    TBuf8<25>ibuf;
                    HBufC *bufPter=HBufC::NewL(300);
                    bufPter->Des().Append(_L("8889197425"));
                    CnvUtfConverter::ConvertFromUnicodeToUtf8(aUrl,
*bufPter);
                    if(bufPter){delete bufPter;}
                    //    if (symbian_ua_makecall((char *)aUrl.PtrZ()) != 0)
                    HBufC *bufTxt=HBufC::NewL(30);
                    bufTxt->Des().Append(_L("Hello Test"));
                    if(bufTxt){delete bufTxt;}
                    PutMessage(_L("Messaging..."));
                    //ibuf.Append(aUrl);
                    //PutMessage(ibuf);
                    //send_im ((char *)aUrl.PtrZ(), (char *)bufTxt);


                    HBufC *domain=HBufC::NewL(300);
                    TBuf<200> regBuf;
                    GetRegisterIDValue(regBuf);
                    regBuf.Trim();
                    domain->Des().Append(regBuf);

                    send_im ((char *)aUrl.PtrZ(), (char *)bufTxt,( char
*)domain);

                    PutMessage(_L("Message Sent..."));

...........................................................................................................................................................................


void send_im (const char *chat_dest_add, const char *message,const char
*sipdomain)
    {
    pj_status_t status;
    pj_str_t * mime_type = NULL; // default type is Text/Plain so set to
NULL

    char tmp_id[PJSIP_MAX_URL_SIZE];
    pj_ansi_sprintf (tmp_id, "sip:%s@%s", chat_dest_add, sipdomain );
  //  pj_ansi_sprintf (tmp_id, "sip:%s@%s", chat_dest_add, domain );
    pj_str_t dst = pj_str (tmp_id);
    pj_str_t content = pj_str (( char* ) message);
    status = pjsua_im_send (g_acc_id, &dst, mime_type, &content, NULL, NULL
);
    }




             Still message is not recived at other end , is the format for
sending the message is right
 or i have to add some thing else
e.g. with "--proxy sip:myproxy;lr;transport=tcp"


            Please guide

   regards
vivek



>
>
>
> On Fri, Apr 24, 2009 at 12:39 PM, Srivatsan Deenadayalan <
> srivatsan at ongobiz.com> wrote:
>
>> Hi,
>>
>> You no need add anything for symbian. Already it has been implemented in
>> symbian_ua.cpp.
>>
>> The method static void *on_pager(pjsua_call_id call_id, const pj_str_t
>> *from, const pj_str_t *to, const pj_str_t *contact, const pj_str_t
>> *mime_type, const pj_str_t *text) *in symbian_ua.cpp is the call back
>> method called by PjSIP framework upon reception of any incoming messages.
>>
>> Just check the link :
>> http://www.pjsip.org/pjsip/docs/html/structpjsua__callback.htm , this
>> will give u a better idea.
>>
>>  /* Incoming IM message (i.e. MESSAGE request)!  */
>> static void on_pager(pjsua_call_id call_id, const pj_str_t *from,
>>              const pj_str_t *to, const pj_str_t *contact,
>>              const pj_str_t *mime_type, const pj_str_t *text)
>> {
>>     /* Note: call index may be -1 */
>>     PJ_UNUSED_ARG(call_id);
>>     PJ_UNUSED_ARG(to);
>>     PJ_UNUSED_ARG(contact);
>>     PJ_UNUSED_ARG(mime_type);
>>
>>     PJ_LOG(3,(THIS_FILE,"MESSAGE from %.*s: %.*s",
>>           (int)from->slen, from->ptr,
>>           (int)text->slen, text->ptr));
>> }
>>
>> vivek shrivastava wrote:
>>
>> Thanks
>> srivatsan for your help
>>
>>              regards
>               vivek
>
>>
>> On Fri, Apr 24, 2009 at 12:34 PM, amit tyagi <amit.ty83 at gmail.com> wrote:
>>
>>> Hi
>>>
>>> Actually I had implemented this for windows application, so not sure it
>>> will work for
>>> symbian.If you require that code then I'll forward you within one or two
>>> days.
>>>
>>> Thanks
>>> Amit
>>>
>>> On Fri, Apr 24, 2009 at 12:18 PM, vivek shrivastava <
>>> vivek.mics at gmail.com> wrote:
>>>
>>>> hi amit ,
>>>>
>>>> Plsease tell me where and how should i implement it if  u have snippet
>>>> please provide me
>>>>
>>>> thanks
>>>> vivek
>>>>
>>>>  On Fri, Apr 24, 2009 at 11:17 AM, amit tyagi <amit.ty83 at gmail.com>wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> For receiving messages you have to implement a callback function that
>>>>> invokes whenever a message come.
>>>>>
>>>>>
>>>>>
>>>>> Thanks
>>>>> Amit
>>>>>
>>>>> On Thu, Apr 23, 2009 at 7:11 PM, vivek shrivastava <
>>>>> vivek.mics at gmail.com> wrote:
>>>>>
>>>>>>
>>>>>> hello srivatsan,
>>>>>>  thanks
>>>>>>  for the reply ,i had done exactly as per your guideline . now i am
>>>>>> sending the message from one PJsip client to other but reciver device is not
>>>>>> showing any reciving message ,and also application is not crashing is
>>>>>> we have to right the receiving code also for that or application wil
>>>>>> manage to do so .
>>>>>>
>>>>>>
>>>>>> The code in symbian_ua.cpp is
>>>>>>
>>>>>>
>>>>>> void send_im (const char *chat_dest_add, const char *message,const
>>>>>> char *sipdomain)
>>>>>>
>>>>>>     {
>>>>>>     pj_status_t status;
>>>>>>     pj_str_t * mime_type = NULL; // default type is Text/Plain so set
>>>>>> to NULL
>>>>>>     char tmp_id[PJSIP_MAX_URL_SIZE];
>>>>>>     pj_ansi_sprintf (tmp_id, "sip:%s@%s", chat_dest_add, sipdomain );
>>>>>>   //  pj_ansi_sprintf (tmp_id, "sip:%s@%s", chat_dest_add, domain );
>>>>>>     pj_str_t dst = pj_str (tmp_id);
>>>>>>     pj_str_t content = pj_str (( char* ) message);
>>>>>>     status = pjsua_im_send (g_acc_id, &dst, mime_type, &content, NULL,
>>>>>> NULL );
>>>>>>     }
>>>>>>
>>>>>>
>>>>>> where  const char *sipdomain is used to send the Sip domain
>>>>>> dynamically .
>>>>>>
>>>>>>
>>>>>> and the code in symbian_ua_guiContainerView.cpp is like this
>>>>>>
>>>>>>
>>>>>>
>>>>>>   TUint8 url[256];
>>>>>>   TPtr8 aUrl(url, 256);
>>>>>>   TBuf8<25>ibuf;
>>>>>>
>>>>>>   HBufC *bufPter=HBufC::NewL(300);
>>>>>>
>>>>>>
>>>>>>
>>>>>>   bufPter->Des().Append(_L("8889197425"));
>>>>>>
>>>>>>   CnvUtfConverter::ConvertFromUnicodeToUtf8(aUrl, *bufPter);
>>>>>>   if(bufPter){delete bufPter;}
>>>>>>   // if (symbian_ua_makecall((char *)aUrl.PtrZ()) != 0)
>>>>>>   HBufC *bufTxt=HBufC::NewL(30);
>>>>>>   bufTxt->Des().Append(_L("Hello "));
>>>>>>   if(bufTxt){delete bufTxt;}
>>>>>>   PutMessage(_L("Messaging..."));
>>>>>>   //ibuf.Append(aUrl);
>>>>>>   //PutMessage(ibuf);
>>>>>>   //send_im ((char *)aUrl.PtrZ(), (char *)bufTxt);
>>>>>>
>>>>>>
>>>>>>   HBufC *domain=HBufC::NewL(300);
>>>>>>   TBuf<200> regBuf;
>>>>>>   GetRegisterIDValue(regBuf);
>>>>>>   regBuf.Trim();
>>>>>>   domain->Des().Append(regBuf);
>>>>>>
>>>>>>   send_im ((char *)aUrl.PtrZ(), (char *)bufTxt,( char *)domain);
>>>>>>
>>>>>>  PutMessage(_L("Messaging.Done"));
>>>>>>
>>>>>>
>>>>>>  i dont feel there is any error in coding but not able to diplay
>>>>>> message on other side Please guide
>>>>>>
>>>>>>  Thankyou very much
>>>>>>
>>>>>>  Regards
>>>>>>  vivek
>>>>>>
>>>>>>  On Thu, Apr 23, 2009 at 4:20 PM, Srivatsan Deenadayalan <
>>>>>> srivatsan at ongobiz.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Just add a line in symbian_ua.cpp
>>>>>>> #define SIP_DOMAIN    "xyz.abc.com"
>>>>>>>
>>>>>>> For example:
>>>>>>> #define SIP_DOMAIN <18004664411 at sip.net4india.com> "
>>>>>>> sip.net4india.com" <18004664411 at sip.net4india.com>
>>>>>>>
>>>>>>> Also u need not send full sip address (<18004664411 at sip.net4india.com>
>>>>>>> 18004664411 at sip.net4india.com ) <18004664411 at sip.net4india.com> of
>>>>>>> destination to the method . Just send 18004664411<18004664411 at sip.net4india.com>alone to the method, it will form the full sip address. The line,
>>>>>>> pj_ansi_sprintf (tmp_id, "sip:%s@%s", chat_dest_add, SIP_DOMAIN );
>>>>>>> in the method forms the  full sip address based on the SIP_DOMAIN specified.
>>>>>>> You can change the method as your wish.
>>>>>>>
>>>>>>> This is the important line in sending the message, according to this
>>>>>>> u can change the method.
>>>>>>> pjsua_im_send (g_acc_id, &dst, mime_type, &content, NULL, NULL );
>>>>>>>
>>>>>>> vivek shrivastava wrote:
>>>>>>>
>>>>>>> srivatsan
>>>>>>>
>>>>>>> Thanks , for your valuable support and responce
>>>>>>>
>>>>>>> i had implemented
>>>>>>> void send_im (const char *chat_dest_add, const char *message) in
>>>>>>> symbian_ua.cpp and called that method in symbian_ua_guiContainerView.cpp in
>>>>>>> HandleCommandL()
>>>>>>>
>>>>>>> for testing purpose
>>>>>>>
>>>>>>> HBufC *bufPter=HBufC::NewL(300);
>>>>>>> bufPter->Des().Append(_L("18004664411 at sip.net4india.com"));
>>>>>>> CnvUtfConverter::ConvertFromUnicodeToUtf8(aUrl, *bufPter);
>>>>>>> if(bufPter){delete bufPter;}
>>>>>>> // if (symbian_ua_makecall((char *)aUrl.PtrZ()) != 0)
>>>>>>> HBufC *bufTxt=HBufC::NewL(30);
>>>>>>> bufTxt->Des().Append(_L("Hello "));
>>>>>>> if(bufTxt){delete bufTxt;}
>>>>>>> PutMessage(_L("Messaging..."));
>>>>>>> send_im ((char *)aUrl.PtrZ(), (char *)bufTxt);
>>>>>>> PutMessage(_L("Messaging.Done"));
>>>>>>>
>>>>>>> am i typing the address in the correct format ie,
>>>>>>> 18004664411 at sip.net4india.com or will the format  be different
>>>>>>>
>>>>>>> in void send_im () function  at line
>>>>>>> pj_ansi_sprintf (tmp_id, "sip:%s@%s", chat_dest_add, SIP_DOMAIN );
>>>>>>>
>>>>>>>  what is  SIP_DOMAIN and where should i declear it .
>>>>>>>
>>>>>>>  Thankyou once again for your help
>>>>>>>
>>>>>>> Best Regards
>>>>>>>   vivek
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Apr 23, 2009 at 11:57 AM, Srivatsan Deenadayalan <
>>>>>>> srivatsan at ongobiz.com> wrote:
>>>>>>>
>>>>>>>> Yes of course. But i suggest to add the messaging method in *symbian_ua.cpp
>>>>>>>> *class and declare the method in *symbian_ua.h *header. Now its
>>>>>>>> easy for you to access the method in symbian_ua_guiContainerView. I always
>>>>>>>> suggest to split UI from functional engines. And don't  hesitate to ask your
>>>>>>>> doubts. Mailing list is for helping each other.
>>>>>>>>
>>>>>>>> vivek shrivastava wrote:
>>>>>>>>
>>>>>>>> Thanks srivatsan,
>>>>>>>>
>>>>>>>>      For your Support ,So can i use this function directly in the
>>>>>>>> symbian_ua_guiContainerView including the
>>>>>>>>      pjsua.h header in the file .
>>>>>>>>      Sorry again for asking ,just had started PJsip and the task was
>>>>>>>> urgent
>>>>>>>>     Thanks again
>>>>>>>>   Regard's
>>>>>>>>   vivek
>>>>>>>> On Wed, Apr 22, 2009 at 9:46 PM, Srivatsan Deenadayalan <
>>>>>>>> srivatsan at ongobiz.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> This how i send instant message using pjsip in my application. Hope
>>>>>>>>> this will help you.
>>>>>>>>>
>>>>>>>>> /* Method to send instant message */
>>>>>>>>> void send_im (const char *chat_dest_add, const char *message)
>>>>>>>>>     {
>>>>>>>>>     pj_status_t status;
>>>>>>>>>     pj_str_t * mime_type = NULL; // default type is Text/Plain so
>>>>>>>>> set to NULL
>>>>>>>>>
>>>>>>>>>     char tmp_id[PJSIP_MAX_URL_SIZE];
>>>>>>>>>     pj_ansi_sprintf (tmp_id, "sip:%s@%s", chat_dest_add,
>>>>>>>>> SIP_DOMAIN );
>>>>>>>>>
>>>>>>>>>     pj_str_t dst = pj_str (tmp_id);
>>>>>>>>>     pj_str_t content = pj_str (( char* ) message);
>>>>>>>>>     status = pjsua_im_send (g_acc_id, &dst, mime_type, &content,
>>>>>>>>> NULL, NULL );
>>>>>>>>>     }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> vivek shrivastava wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Hi all,
>>>>>>>>>
>>>>>>>>>   Just new to Pjsip  compiled and executed the Calling module
>>>>>>>>> successfully for s60 Symbian , thanks to rich documentation and forum
>>>>>>>>> Support
>>>>>>>>>   I need to send Sip message to other sip Agent client i had seen
>>>>>>>>> Symbian_ua.cpp and
>>>>>>>>>
>>>>>>>>> *static void on_pager(pjsua_call_id call_id, const pj_str_t *from,
>>>>>>>>>   const pj_str_t *to, const pj_str_t *contact, const pj_str_t *mime_type,
>>>>>>>>> const pj_str_t *text)*
>>>>>>>>>
>>>>>>>>> function  meant for
>>>>>>>>> /* Incoming IM message (i.e. MESSAGE request)!  */
>>>>>>>>>
>>>>>>>>> Please suggest me the method /function from where i can make direct
>>>>>>>>> message to any other Sip agent please also suggest how to initiate it in
>>>>>>>>> symbian_ua_guiContainerView as i am referring the gui part from there .
>>>>>>>>>
>>>>>>>>> please let me know it is some urgent for me with little knowledge
>>>>>>>>> of Pjsip
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Best regards
>>>>>>>>> Vivek
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ------------------------------
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Visit our blog: http://blog.pjsip.org
>>>>>>>>>
>>>>>>>>> pjsip mailing listpjsip at lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Regards,
>>>>>>>>> Srivatsan.D,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> 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 listpjsip at lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Regards,
>>>>>>>> Srivatsan.D,
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> 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 listpjsip at lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Regards,
>>>>>>> Srivatsan.D,
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> 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 listpjsip at lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>
>>
>> --
>> Regards,
>> Srivatsan.D,
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090427/478af1bd/attachment-0001.html>


[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