PREV TOC HOME INDEX NEXT


ipm_Stop( )


Termination Events | Cautions | Errors | Example | See Also

Name: int ipm_Stop(nDeviceHandle, eOperation, usMode)
Inputs:

int nDeviceHandle

  • IP Media device handle

eIPM_STOP_OPERATION eOperation

  • operation to be stopped

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_Stop( ) function stops operations on the specified IP channel.

To run this function asynchronously, set mode to EV_ASYNC. The function returns 0 if successful and the application must wait for the IPMEV_STOPPED event.

Parameter

Description

nDeviceHandle handle of the IP Media device
eOperation media operation enumeration. Only one value can be set at a time. The eIPM_STOP_OPERATION data type is an enumeration that defines the following values:
  • STOP_SEND_DIGITS
    operation of sending digits
  • STOP_RECEIVE_DIGITS
    operation of receiving digits
  • STOP_RECEIVE_DIGITS_RFC2833
    operation of receiving RFC 2833 digits
  • STOP_MEDIA
    operation of media session.This enumeration disconnects the session. The application must call ipm_StartMedia( ) to start a new session.
  • STOP_ALL
    stop all operations
usMode operation mode. Set to EV_ASYNC for asynchronous execution or to EV_SYNC for synchronous execution.

Termination Events

IPMEV_STOPPED
indicates that activity of the type specified in eIPM_STOP_OPERATION has terminated on this channel. This event does not return data.
IPMEV_ERROR
indicates the function failed.

Cautions

None.

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_FWERROR
Firmware 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
    .
    .
    */
    /*
    Application needs to stop a current session on IP device handle, nDeviceHandle
    ASSUMPTION: A valid nDeviceHandle was obtained from prior call to ipm_Open()
    and a session has been started by calling ipm_StartMedia()
    sometime earlier.
    */
    if(ipm_Stop(nDeviceHandle, STOP_ALL, EV_ASYNC) == -1)
    {
        printf("ipm_Stop failed for device name = %s with error = %d\n",
            ATDV_NAMEP(nDeviceHandle), ATDV_LASTERR(nDeviceHandle));
            /*
            .
            .
            Perform Error Processing
            .
            .
        */
    }
    /*
    .
    . Continue Processing
    .
    */
} 
void CheckEvent()
{
    int nEventType = sr_getevttype();
    int nDeviceID = sr_getevtdev();
    switch(nEventType)
    {
    /*
    .
    . List of expected events
    .
        */
        /* Expected reply from ipm_Stop() */
    case IPMEV_STOPPED:
        printf("Received IPMEV_STOPPED 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