PREV TOC HOME INDEX NEXT


ipm_GetLocalMediaInfo( )


Termination Events | Cautions | Errors | Example | See Also

Name: int ipm_GetLocalMediaInfo(nDeviceHandle, *pMediaInfo, usMode)
Inputs:

int nDeviceHandle

  • IP Media device handle

IPM_MEDIA_INFO *pMediaInfo

  • pointer to media information structure

unsigned short usMode

  • async or sync mode setting
Returns:

0 on success

-1 on failure

Includes:

srllib.h

ipmlib.h

Category:

Media Session

Mode:

asynchronous or synchronous

Platform:

DM/IP, IPT, HMP

Description

The ipm_GetLocalMediaInfo( ) function retrieves properties for the local media channel. This function retrieves the local RTP/RTCP port and IP address information or T.38 port and IP address information associated with the specified IP channel. These properties are assigned during firmware download.

To run this function asynchronously, set mode to EV_ASYNC. The function returns 0 if successful and the application must wait for the IPMEV_GET_LOCAL_MEDIA_INFO event. Once the event has been returned, use SRL functions to retrieve IPM_MEDIA_INFO structure fields.

To run this function synchronously, set mode to EV_SYNC. The function returns 0 if successful and the IPM_MEDIA_INFO structure fields will be filled in.

Parameter

Description

nDeviceHandle handle of the IP Media device
pMediaInfo pointer to structure that contains local channel RTP / RTCP ports and IP address information or T.38 port and IP address information. See the IPM_MEDIA_INFO data structure page for details.
usMode operation mode. Set to EV_ASYNC for asynchronous execution or to EV_SYNC for synchronous execution.

Termination Events

IPMEV_GET_LOCAL_MEDIA_INFO
indicates successful completion, that is, local media information was received. Once the event has been returned, use SRL functions to retrieve IPM_MEDIA_INFO structure fields.
IPMEV_ERROR
indicates the function failed.

Cautions

Errors

If the function returns -1 to indicate failure, call ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to return one of the following errors:

EIPM_BADPARM
Invalid parameter
EIPM_INTERNAL
Internal error
EIPM_INV_MODE
Invalid mode
EIPM_INV_STATE
Invalid state. Initial command did not complete before another function call was made.
EIPM_SYSTEM
System error

Example

#include <stdio.h>
#include <srllib.h>
#include <ipmlib.h> 
typedef long int(*HDLR)(unsigned long);
void CheckEvent(); 
void main()
{
    int nDeviceHandle;
    // Register event handler function with srl
    sr_enbhdlr( EV_ANYDEV ,EV_ANYEVT ,(HDLR)CheckEvent);
    /*
    .
    .
    Main Processing
    .
    .
    .
    */ 
    /*
    Get the local IP information for IP device handle, nDeviceHandle.
    ASSUMPTION: A valid nDeviceHandle was obtained from prior call to ipm_Open().
    */
    IPM_MEDIA_INFO MediaInfo;
    MediaInfo.unCount = 1;
    MediaInfo.MediaData[0].eMediaType = MEDIATYPE_LOCAL_RTP_INFO;
    // MediaInfo.MediaData[0].eMediaType = MEDIATYPE_LOCAL_T38_INFO;
    if(ipm_GetLocalMediaInfo(nDeviceHandle, &MediaInfo, EV_ASYNC) == -1)
    {
        printf("ipm_GetLocalMediaInfo failed for device name %s with error = %d\n",
            ATDV_NAMEP(nDeviceHandle), ATDV_LASTERR(nDeviceHandle));
        /*
        .
        Perform Error Processing
        .
        */
    }
    /*
    .
    . Continue processing
    .
    */
} 
void CheckEvent()
{
    unsigned int i;
    int nDeviceID = sr_getevtdev();
    int nEventType = sr_getevttype();
    void* pVoid = sr_getevtdatap();
    IPM_MEDIA_INFO* pMediaInfo;
    switch(nEventType)
    {
    /*
    .
    .
    . Other events
    .
    .
    */
    /* Expected reply to ipm_GetLocalMediaInfo */
        case IPMEV_GET_LOCAL_MEDIA_INFO:
            printf("Received IPMEV_GET_LOCAL_MEDIA_INFO for device name = %s\n",
                ATDV_NAMEP(nDeviceID));
            pMediaInfo = (IPM_MEDIA_INFO*)pVoid;
            for(i=0; i<pMediaInfo->unCount; i++)
            {
                if(MEDIATYPE_LOCAL_RTP_INFO == pMediaInfo->MediaData[i].eMediaType)
                    printf("MediaType = MEDIATYPE_RTP_INFO!!\n");

                printf("PortId= %d\n",pMediaInfo->MediaData[i].mediaInfo.PortInfo.unPortId);
                printf("IPAddress=%s\n",pMediaInfo->MediaData[i].mediaInfo.PortInfo.cIPAddress);
            }
            break;
        default:
            printf("Received unknown event = %d for device name = %s\n",
                nEventType, ATDV_NAMEP(nDeviceID));
            break;
    }
} 

See Also


PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

Copyright 2002, Intel Corporation
All rights reserved
This page generated November, 2002