⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmcallmessages.c

📁 基于h323协议的软phone
💻 C
📖 第 1 页 / 共 2 页
字号:
            ret = setNonStandardParam(app->hVal,nonStandardId,param);
        }
        emaUnlock((EMAElement)hsCall);
    }

    if (ret >= 0)
        ret = rootId;

    cmiAPIExit((HAPP)app,(char*)"cmCallProgressCreate: [%d]", ret);
    return ret;
}


/************************************************************************************
 *
 * cmCallProgressGet
 *
 * Purpose: To decode PROGRESS message
 *
 * Input:   hApp                    - The stack instance handle
 *          message                 - Progress message to decode
 *          displaySize             - The display field size in bytes.
 *
 * Output:  display                 - The display field (user allocated memory)
 *          cause                   - The causeValue (-1 if absent)
 *          pi_IE                   - Indicator whether IE to use for progressIndicator IE
 *                                    30 , 31 or both
 *          progressDescription     - The value of the progressIndicator's progressDescription (-1 if absent)
 *          notificationDescription - The value of the notifyIndicator's notifyDescription (-1 if absent)
 *          param                   - The nonStandardParam from the message (param->length==RV_ERROR_UNKNOWN if it wasn't there)
 *          ** Any of the output fields can be passed as NULL if the
 *             application doesn't care about their values
 *
 * Returned value: A nonnegative value on success
 *
 **************************************************************************************/
RVAPI
int RVCALLCONV cmCallProgressGet(
        IN  HAPP                hApp,
                               IN  int              message,
                               OUT char*            display,
                               IN  int              displaySize,
                               OUT int*             cause,
                               OUT progressInd_IE*  pi_IE,
                               OUT int*             progressDescription,
                               OUT int*             notificationDescription,
                               OUT cmNonStandardParam* param)
{
    cmElem* app;
    int q931NodeId,nodeId;
    HPVT hVal;
    app = (cmElem* )hApp;
    if (!app)return RV_ERROR_UNKNOWN;
    hVal=app->hVal;

    cmiAPIEnter((HAPP)app,(char*)"cmCallProgressGet: hApp=0x%p,nodeId=%d ",hApp,message);

    q931NodeId=pvtGetChild2(hVal,message,__q931(message),__q931(progress));
    if (display)
    {
        nodeId=pvtGetChild(hVal,q931NodeId,__q931(display),NULL);
        if (displaySize > 0)
            display[0] = 0;
        if (nodeId>=0)
        {
            int size;
            size=pvtGetString(app->hVal,nodeId,displaySize,display);
            if(size<displaySize) display[size]=0;
        }
    }
    if (cause)
    {
        *cause=RV_ERROR_UNKNOWN;
        __pvtGetByFieldIds(nodeId,hVal,q931NodeId,
                        {_q931(cause)
                         _q931(octet4)
                         _q931(causeValue)
                         LAST_TOKEN}, NULL, cause, NULL);
    }
    if (progressDescription)
    {
        *progressDescription=RV_ERROR_UNKNOWN;
        *pi_IE=(progressInd_IE)RV_ERROR_UNKNOWN;
        __pvtGetByFieldIds(nodeId,hVal,q931NodeId,
                            {_q931(progressIndicator)
                             _q931(octet4)
                             _q931(progressDescription)
                             LAST_TOKEN}, NULL,progressDescription, NULL);
        if (nodeId>=0)
            *pi_IE=use30asPI_IE;
        else
        {
            __pvtGetByFieldIds(nodeId,hVal,q931NodeId,
                            {_q931(progressIndicator)
                             _q931(octet4)
                             _q931(progressDescription)
                             LAST_TOKEN}, NULL, progressDescription, NULL);

            if (nodeId>=0)
               *pi_IE=use31asPI_IE;
        }
    }
    if (notificationDescription)
    {
        *notificationDescription=RV_ERROR_UNKNOWN;
        __pvtGetByFieldIds(nodeId,hVal,q931NodeId,
                        {_q931(notificationIndicator)
                         _q931(octet3)
                         _q931(notificationDescription)
                         LAST_TOKEN}, NULL, notificationDescription, NULL);
    }
    if (param)
    {
        __pvtGetNodeIdByFieldIds(nodeId,hVal,q931NodeId,
                                {_q931(userUser)
                                _q931(h323_UserInformation)
                                _q931(h323_uu_pdu)
                                _q931(nonStandardData)
                                LAST_TOKEN});
        if (nodeId>=0)
            getNonStandardParam(hVal,nodeId,param);
        else
            param->length = -1;
    }
    cmiAPIExit((HAPP)app,(char*)"cmCallProgressGet: [OK]");
    return RV_TRUE;
}


/************************************************************************************
 *
 * cmCallNotifyCreate
 *
 * Purpose: To create NOTIFY message and fill it with the specified parameters
 *
 * Input:   hsCall                  - The stack handle to the call
 *          display                 - The display field
 *          notificationDescription - The value of the notifyIndicator's notifyDescription (-1 if not used)
 *          param                   - The nonStandardParam to be put into the message
 *
 * Output:  None.
 *
 * Returned value: The root node ID of the created notify message on success
 *                 This root value should be passed to cmCallNotify() function.
 *                 Negative value on failure
 *
 **************************************************************************************/
RVAPI
int RVCALLCONV cmCallNotifyCreate(
        IN HCALL                hsCall,
                                  IN char*          display,
                                  IN int            notificationDescription,
                                  IN cmNonStandardParam* param)
{
    cmElem* app=(cmElem*)emaGetInstance((EMAElement)hsCall);
    int nodeId,rootId,ret=1,q931NodeId,nonStandardId;
    if (!hsCall || !app) return RV_ERROR_UNKNOWN;

    cmiAPIEnter((HAPP)app,(char*)"cmCallNotifyCreate: hsCall=0x%p, Display %s",hsCall,nprn(display));
    rootId=pvtAddRoot(app->hVal,app->synProtQ931,0,NULL);
    if (rootId<0)
    {
        cmiAPIExit((HAPP)app,(char*)"cmCallNotifyCreate: [%d]",rootId);
        return rootId;
    }
    if (emaLock((EMAElement)hsCall))
    {
        nodeId=callGetMessage(hsCall,cmQ931notify);

        ret =pvtSetTree(app->hVal,rootId,app->hVal,nodeId);
        if (ret<0)
        {
            emaUnlock((EMAElement)hsCall);
            cmiAPIExit((HAPP)app,(char*)"cmCallNotifyCreate: [%d]",ret);
            return ret;
        }
        __pvtBuildByFieldIds(q931NodeId,app->hVal,rootId,
                                {_q931(message) _q931(notify) LAST_TOKEN},0,NULL);

        if (notificationDescription>=0)
        {
            __pvtBuildByFieldIds(ret,app->hVal,q931NodeId,
                                    {_q931(notificationIndicator)
                                     _q931(octet3) _q931(notificationDescription) LAST_TOKEN},notificationDescription,NULL);
        }
        if (display!=NULL)
            pvtAdd(app->hVal,q931NodeId,__q931(display),(int)strlen(display),display,NULL);

        if (param!=NULL)
        {
            __pvtBuildByFieldIds(nonStandardId,app->hVal,q931NodeId,
                                {_q931(userUser)
                                 _q931(h323_UserInformation)
                                 _q931(h323_uu_pdu)
                                 _q931(nonStandardData)
                                 LAST_TOKEN},0,NULL);

            ret = setNonStandardParam(app->hVal,nonStandardId,param);
        }
        emaUnlock((EMAElement)hsCall);
    }

    if (ret >= 0)
        ret = rootId;

    cmiAPIExit((HAPP)app,(char*)"cmCallNotifyCreate: [%d]",ret);
    return ret;
}


/************************************************************************************
 *
 * cmCallNotifyGet
 *
 * Purpose: To decode NOTIFY message
 *
 * Input:   hApp                    - The stack instance handle
 *          message                 - Progress message to decode
 *          displaySize             - The display field size in bytes.
 *
 * Output:  display                 - The display field (user allocated memory)
 *          notificationDescription - The value of the notifyIndicator's notifyDescription (-1 if absent)
 *          param                   - The nonStandardParam from the message (param->length==RV_ERROR_UNKNOWN if it wasn't there)
 *          ** Any of the output fields can be passed as NULL if the
 *             application doesn't care about their values
 *
 * Returned value: A nonnegative value on success
 *
 **************************************************************************************/
RVAPI
int RVCALLCONV cmCallNotifyGet(
                           IN HAPP hApp,
                           IN  int              message,
                           OUT char*            display,
                           IN  int              displaySize,
                           OUT int*             notificationDescription,
                           OUT cmNonStandardParam* param)
{
    cmElem* app;
    int q931NodeId,nodeId;
    HPVT hVal;
    app = (cmElem* )hApp;
    if (!app)return RV_ERROR_UNKNOWN;
    hVal=app->hVal;

    cmiAPIEnter((HAPP)app,(char*)"cmCallNotifyGet: hApp=0x%p,nodeId=%d ",hApp,message);

    q931NodeId=pvtGetChild2(hVal,message,__q931(message),__q931(notify));
    if (q931NodeId < 0) return q931NodeId;
    if (display)
    {
        nodeId=pvtGetChild(hVal,q931NodeId,__q931(display),NULL);
        if (displaySize > 0)
            display[0] = 0;
        if (nodeId>=0)
        {
            int size;
            size=pvtGetString(app->hVal,nodeId,displaySize,display);
            if(size<displaySize) display[size]=0;
        }
    }
    if (notificationDescription)
    {
        *notificationDescription=RV_ERROR_UNKNOWN;
        __pvtGetByFieldIds(nodeId,hVal,q931NodeId,
                        {_q931(notificationIndicator)
                         _q931(octet3)
                         _q931(notificationDescription)
                         LAST_TOKEN}, NULL, notificationDescription, NULL);
    }
    if (param)
    {
        __pvtGetNodeIdByFieldIds(nodeId,hVal,q931NodeId,
                                {_q931(userUser)
                                _q931(h323_UserInformation)
                                _q931(h323_uu_pdu)
                                _q931(nonStandardData)
                                LAST_TOKEN});
        if (nodeId>=0)
            getNonStandardParam(hVal,nodeId,param);
        else
            param->length = -1;
    }
    cmiAPIExit((HAPP)app,(char*)"cmCallNotifyGet: [OK]");
    return RV_TRUE;
}


#ifdef __cplusplus
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -