PREV TOC HOME INDEX NEXT


ipm_SetRemoteMediaInfo( )


Termination Events | Cautions | Errors | Example | See Also

Name: int ipm_SetRemoteMediaInfo(nDeviceHandle, *pMediaInfo, eDirection, usMode)
Inputs:

int nDeviceHandle

  • IP Media device handle

IPM_MEDIA_INFO *pMediaInfo

  • pointer to media information structure

eIPM_DATA_DIRECTION eDirection

  • data flow direction

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

Note: We strongly recommend that you use the ipm_StartMedia( ) function instead of ipm_SetRemoteMediaInfo( ). Support for the ipm_SetRemoteMediaInfo( ) function may be removed from future versions of the IP media API.

The ipm_SetRemoteMediaInfo( ) function sets media properties and starts the session. This function allows the application to set the remote and local connectivity selections. ipm_SetRemoteMediaInfo( ) also starts RTP streaming. The remote RTP/ RTCP port information and coder information is provided in the IPM_MEDIA_INFO structure.

Parameter

Description

nDeviceHandle handle of the IP Media device
pMediaInfo pointer to structure; see IPM_MEDIA_INFO for details. Applications can define the following:
  • local transmit coder and remote transmit coder
  • local and remote RTP/RTCP protocol
  • local and remote IP address
eDirection media operation enumeration The eIPM_DATA_DIRECTION data type is an enumeration which defines the following values:
  • DATA_IP_RECEIVEONLY
    receives data from the IP network but no data is sent.
  • DATA_IP_SENDONLY
    sends data to the IP network but no data is received.
  • DATA_IP_TDM_BIDIRECTIONAL
    full duplex data path (streaming media) between IP network and TDM. Used for gateway functionality.
  • DATA_MULTICAST_SERVER
    multicast server mode
  • DATA_MULTICAST_CLIENT
    multicast client mode
usMode operation mode. Set to EV_ASYNC for asynchronous execution or to EV_SYNC for synchronous execution.

Termination Events

IPMEV_SET_REMOTE_MEDIA_INFO
indicates successful completion, that is, media information was set and the session has been started. 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_BUSY
Channel is busy
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 <string>
#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
    .
    .
    .
    */
    /*
    Set the media properties for a remote party using IP device handle, nDeviceHandle.
    ASSUMPTION: A valid nDeviceHandle was obtained from prior call to ipm_Open().
    */
    IPM_MEDIA_INFO MediaInfo;
    MediaInfo.unCount = 4;
    MediaInfo.MediaData[0].eMediaType = MEDIATYPE_REMOTE_RTP_INFO;
    MediaInfo.MediaData[0].mediaInfo.PortInfo.unPortId = 2328;
    strcpy(MediaInfo.MediaData[0].mediaInfo.PortInfo.cIPAddress,"111.21.0.9\n");
    MediaInfo.MediaData[1].eMediaType = MEDIATYPE_REMOTE_RTCP_INFO;
    MediaInfo.MediaData[1].mediaInfo.PortInfo.unPortId = 2329;
    strcpy(MediaInfo.MediaData[1].mediaInfo.PortInfo.cIPAddress,"111.41.0.9\n");
    MediaInfo.MediaData[2].eMediaType = MEDIATYPE_REMOTE_CODER_INFO;
    MediaInfo.MediaData[2].mediaInfo.CoderInfo.eCoderType = CODER_TYPE_G711ULAW64K;
    MediaInfo.MediaData[2].mediaInfo.CoderInfo.eFrameSize = (eIPM_CODER_FRAMESIZE) 30;
    MediaInfo.MediaData[2].mediaInfo.CoderInfo.unFramesPerPkt = 1;
    MediaInfo.MediaData[2].mediaInfo.CoderInfo.eVadEnable = CODER_VAD_DISABLE;
    MediaInfo.MediaData[2].mediaInfo.CoderInfo.unCoderPayloadType = 0;
    MediaInfo.MediaData[2].mediaInfo.CoderInfo.unRedPayloadType = 0;
    MediaInfo.MediaData[3].eMediaType = MEDIATYPE_LOCAL_CODER_INFO;
    MediaInfo.MediaData[3].mediaInfo.CoderInfo.eCoderType = CODER_TYPE_G711ULAW64K;
    MediaInfo.MediaData[3].mediaInfo.CoderInfo.eFrameSize = (eIPM_CODER_FRAMESIZE) 30;
    MediaInfo.MediaData[3].mediaInfo.CoderInfo.unFramesPerPkt = 1;
    MediaInfo.MediaData[3].mediaInfo.CoderInfo.eVadEnable =CODER_VAD_DISABLE;
    MediaInfo.MediaData[3].mediaInfo.CoderInfo.unCoderPayloadType = 0;
    MediaInfo.MediaData[3].mediaInfo.CoderInfo.unRedPayloadType = 0;
    if(ipm_SetRemoteMediaInfo(nDeviceHandle, &MediaInfo,DATA_IP_TDM_BIDIRECTIONAL, EV_ASYNC) ==
        -1)
    {
        printf("ipm_SetRemoteMediaInfo failed for device name = %s with error = %d\n",
            ATDV_NAMEP(nDeviceHandle), ATDV_LASTERR(nDeviceHandle));
            /*
            .
            .
            Perform Error Processing
            .
            .
        */
    }
    /*
    .
    . Continue processing
    .
    */
} 
void CheckEvent()
{
    int nDeviceID = sr_getevtdev();
    int nEventType = sr_getevttype();
    switch(nEventType)
    {
    /*
    .
    .
    . Other events
    .
    .
        */
        /* Expected reply to ipm_SetRemoteMediaInfo */
    case IPMEV_SET_REMOTE_MEDIA_INFO:
        printf("Received IPMEV_SET_REMOTE_MEDIA_INFO for device = %s\n",
            ATDV_NAMEP(nDeviceID));
        break;
    default:
        printf("Received unknown event = %d for device = %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