Regarding T.38 Fax

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

 



Dear Sandeep,
       I forward this toptic to pjsip mail list.It will be helpful for
others to join this discussion and give you advice for pjsua API
patching.
I didn't try to use pjsua to handle T.38 fax because I select pjsip-ua
level after I read pjsip develop guide for performance purpose.

regards,
Gang

On Thu, Feb 19, 2009 at 10:56 PM, Sandeep Mailk <malik.mca at gmail.com> wrote:
> Hi Gang,
>
> You are right the PJSUA api don't export the API's for handling our own SDP
> so what I have done is as follows:
>
> For Tx side:
>
> I had to Tap the pjsua_call_set_hold function and wrote a new function named
> pjsua_media_channel_create_T38sdp which is similar to the
> pjsua_media_channel_create_sdp.
>
>
> For Rx side:
>
> I had to tap the on_rx_offer function which again uses the
> pjsua_media_channel_create_T38sdp function to create the T.38 sdp
>
> The function pjsua_media_channel_create_T38sdp internally calls another
> function named pjmedia_endpt_create_T38sdp which does the creation of T.38
> SDP and is a modified version of pjmedia_endpt_create_sdp.
>
> Now I am able to send the updated SDP with T.38 parameters in reInvite but
> the issue comes while processing the offer. When an offer is processed
> function pjmedia_session_info_from_sdp is called which does parsing of offer
> recieved in SDP. But since the T.38 is not supported as a standard part of
> PJSIP the stack send BYE.
>
> To solve this one way would be to write another function which does parsing
> of recieved offer but if you can suggest a better way it would be good for
> me. I just started working on PJSIP so don't have much idea about the
> consequences of all such modifications.
>
>
> Regards,
> Sandeep Malik
>
> On Thu, Feb 19, 2009 at 4:07 PM, Gang Liu <gangban.lau at gmail.com> wrote:
>>
>> I used my own function to handle re-INVITE because my apps need wait
>> some time to get related media information. And I can't block at
>> on_rx_offer().
>> I think it is more better to use on_rx_offer if you can.
>>
>> I am using pjsip-ua, not pjsua api.
>>
>> As I remember, pjsua api don't export function for handling our own
>> SDP. So maybe it need
>> patch pjsua api for T.38 fax handling. Correct me if I am wrong.
>>
>>
>> regards,
>> Gang
>>
>> On Wed, Feb 18, 2009 at 6:48 PM, Sandeep Mailk <malik.mca at gmail.com>
>> wrote:
>> > Hi Gang,
>> >
>> > And when are you calling this function to create the SDP offer/answer? I
>> > mean have you written your own function to override the
>> > pjsua_call_on_rx_offer function or you are calling this from inside of
>> > that
>> > function?
>> >
>> > Regards,
>> > Sandeep Malik
>> >
>> > On Tue, Feb 3, 2009 at 12:08 PM, Gang Liu <gangban.lau at gmail.com> wrote:
>> >>
>> >> I create my own SDP offer/answer for T.38 fax like below:
>> >>
>> >> CallRec is my own struct. And some value for t38 params are hardcoded.
>> >>
>> >> /*
>> >>  * Create SDP offer/answer for T.38 FAX.
>> >>  * is_sdp_answer, whether SDP answer or offer
>> >>  */
>> >> int sdp_t38_create(CallRec * call, pjmedia_sdp_session **p_sdp,
>> >> pj_bool_t is_sdp_answer)
>> >> {
>> >>        pj_pool_t *pool;
>> >>    pjmedia_sdp_session *sdp;
>> >>    pjmedia_sdp_media *m;
>> >>    pjmedia_sdp_attr *attr;
>> >>
>> >>        if (call->data.is_assigned && call->data.inv)
>> >>                pool = call->data.inv->dlg->pool;
>> >>        else
>> >>                return -1;
>> >>
>> >>    /* Create and initialize basic SDP session */
>> >>    sdp = (pjmedia_sdp_session *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_session));
>> >>
>> >>        sdp_set_origin(call, sdp);
>> >>
>> >>    sdp->name = pj_str("SIP CALL");
>> >>
>> >>    /* Since we only support one media stream at present, put the
>> >>     * SDP connection line in the session level.
>> >>     */
>> >>    sdp->conn = (pjmedia_sdp_conn *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_conn));
>> >>    sdp->conn->net_type = pj_str("IN");
>> >>    sdp->conn->addr_type = pj_str("IP4");
>> >>        sdp->conn->addr = pj_str(call->data.local_sdp_audio_ip);
>> >>
>> >>    /* SDP time */
>> >>    sdp->time.start = sdp->time.stop = 0;
>> >>
>> >>    /* Create media stream 0: */
>> >>    sdp->media_count = 1;
>> >>    m = (pjmedia_sdp_media *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_media));
>> >>    sdp->media[0] = m;
>> >>
>> >>    /* Standard media info: */
>> >>    m->desc.media = pj_str("image");
>> >>        m->desc.port = call->data.local_sdp_audio_port;
>> >>    m->desc.port_count = 1;
>> >>    m->desc.transport = pj_str("udptl");
>> >>
>> >>    /* Add format and rtpmap for each codec. */
>> >>    m->desc.fmt_count = 0;
>> >>    m->attr_count = 0;
>> >>
>> >>        m->desc.fmt[m->desc.fmt_count++] = pj_str("t38");
>> >>
>> >>        if (is_sdp_answer)
>> >>        {
>> >>
>> >>                {
>> >>                        attr = (pjmedia_sdp_attr *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_attr));
>> >>                        attr->name = pj_str("T38FaxVersion");
>> >>
>> >>                        char ptstr[10];
>> >>                        snprintf(ptstr, sizeof(ptstr), "%d", 0);
>> >>                        pj_strdup2(pool, &attr->value, ptstr);
>> >>
>> >>                        m->attr[m->attr_count++] = attr;
>> >>                }
>> >>
>> >>                {
>> >>                        attr = (pjmedia_sdp_attr *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_attr));
>> >>                        attr->name = pj_str("T38MaxBitRate");
>> >>
>> >>                        char ptstr[10];
>> >>                        snprintf(ptstr, sizeof(ptstr), "%d",
>> >> globaldata.t38_max_bit_rate);
>> >>                        pj_strdup2(pool, &attr->value, ptstr);
>> >>
>> >>                        m->attr[m->attr_count++] = attr;
>> >>                }
>> >>
>> >>                {
>> >>                        attr = (pjmedia_sdp_attr *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_attr));
>> >>                        attr->name = pj_str("T38FaxFillBitRemoval");
>> >>
>> >>                        char ptstr[10];
>> >>                        snprintf(ptstr, sizeof(ptstr), "%d", 0);
>> >>                        pj_strdup2(pool, &attr->value, ptstr);
>> >>
>> >>                        m->attr[m->attr_count++] = attr;
>> >>                }
>> >>
>> >>                {
>> >>                        attr = (pjmedia_sdp_attr *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_attr));
>> >>                        attr->name = pj_str("T38FaxTranscodingMMR");
>> >>
>> >>                        char ptstr[10];
>> >>                        snprintf(ptstr, sizeof(ptstr), "%d", 0);
>> >>                        pj_strdup2(pool, &attr->value, ptstr);
>> >>
>> >>                        m->attr[m->attr_count++] = attr;
>> >>                }
>> >>
>> >>                {
>> >>                        attr = (pjmedia_sdp_attr *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_attr));
>> >>                        attr->name = pj_str("T38FaxTranscodingJBIG");
>> >>
>> >>                        char ptstr[10];
>> >>                        snprintf(ptstr, sizeof(ptstr), "%d", 0);
>> >>                        pj_strdup2(pool, &attr->value, ptstr);
>> >>
>> >>                        m->attr[m->attr_count++] = attr;
>> >>                }
>> >>
>> >>                {
>> >>                        attr = (pjmedia_sdp_attr *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_attr));
>> >>                        attr->name = pj_str("T38FaxRateManagement");
>> >>
>> >>                        char ptstr[32];
>> >>                        snprintf(ptstr, sizeof(ptstr), "%s",
>> >> "transferredTCF");
>> >>                        pj_strdup2(pool, &attr->value, ptstr);
>> >>
>> >>                        m->attr[m->attr_count++] = attr;
>> >>                }
>> >>
>> >>                {
>> >>                        attr = (pjmedia_sdp_attr *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_attr));
>> >>                        attr->name = pj_str("T38FaxMaxBuffer");
>> >>
>> >>                        char ptstr[10];
>> >>                        snprintf(ptstr, sizeof(ptstr), "%d",
>> >> globaldata.t38_fax_max_buf);
>> >>                        pj_strdup2(pool, &attr->value, ptstr);
>> >>
>> >>                        m->attr[m->attr_count++] = attr;
>> >>                }
>> >>
>> >>                {
>> >>                        attr = (pjmedia_sdp_attr *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_attr));
>> >>                        attr->name = pj_str("T38FaxMaxDatagram");
>> >>
>> >>                        char ptstr[10];
>> >>                        snprintf(ptstr, sizeof(ptstr), "%d",
>> >> globaldata.t38_fax_max_datagram);
>> >>                        pj_strdup2(pool, &attr->value, ptstr);
>> >>
>> >>                        m->attr[m->attr_count++] = attr;
>> >>                }
>> >>
>> >>                {
>> >>                        attr = (pjmedia_sdp_attr *)pj_pool_zalloc(pool,
>> >> sizeof(pjmedia_sdp_attr));
>> >>                        attr->name = pj_str("T38FaxUdpEC");
>> >>
>> >>                        char ptstr[32];
>> >>                        snprintf(ptstr, sizeof(ptstr), "%s",
>> >> "t38UDPRedundancy");
>> >>                        pj_strdup2(pool, &attr->value, ptstr);
>> >>
>> >>                        m->attr[m->attr_count++] = attr;
>> >>                }
>> >>
>> >>        }
>> >>
>> >>    /* Done */
>> >>    *p_sdp = sdp;
>> >>
>> >>    return PJ_SUCCESS;
>> >> }
>> >>
>> >> On Tue, Feb 3, 2009 at 1:14 PM, Sandeep Mailk <malik.mca at gmail.com>
>> >> wrote:
>> >> > Hi Gang,
>> >> >
>> >> > Thank you for response. Can you please share the sample code
>> >> > demonstrating
>> >> > how the implementation is being done for T.38 which we can use as a
>> >> > reference?
>> >> >
>> >> > Regards,
>> >> > Sandeep Malik
>> >> >
>> >> > On Tue, Feb 3, 2009 at 10:40 AM, Gang Liu <gangban.lau at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> What issues?
>> >> >> It is ok for me pjsip 0.9.0-release. I use pjsip-ua api.
>> >> >>
>> >> >> regards,
>> >> >> Gang
>> >> >>
>> >> >> On Fri, Jan 30, 2009 at 3:20 PM, Sandeep Mailk <malik.mca at gmail.com>
>> >> >> wrote:
>> >> >> > Hi,
>> >> >> >
>> >> >> > I am using PJSIP version 0.7 and trying to send T.38 Fax but I am
>> >> >> > facing
>> >> >> > some issues. Do we have some working example of T.38 fax
>> >> >> > integrated
>> >> >> > with
>> >> >> > PJSIP?
>> >> >> >
>> >> >> > --
>> >> >> > Regards,
>> >> >> > Sandeep Malik
>> >> >> > +919818184745
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > 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
>> >> >
>> >> >
>> >> >
>> >
>> >
>
>
>
> --
> Regards,
> Sandeep Malik
> +919818184745
>



[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