Program Documentation

KyungTae Kim
Computer Science
Columbia University
New York, NY 10027
USA
kk521@columbia.edu

 

Abstract

System requirements

This version of sip-mbus requires Windows NT 4.0, Solaris or Linux and some external programs.

Installation instructions

 This explain is for Unix compatible O/S. In Windows compatible O/S, Visual C++ can be used.

When rat-4.2.12.tar.gz  is extracted from the archive, it makes four directories, common, rat, tcl-8.0 and tk-8.0. common directory contains mbus library source code. The patch directory has two files (rtp.c and rtp.h) in common directory and they should be overwritten and then compile them.

$ cp patch/common/* $(RAT-DIRECTORY)/common

$ ./configuration

$ make 

tcl-8.0 and tk-8.0 directories have tcl/tk source code for mbus library engines, media and user interface of RAT.

$ ./configuration

$ make

rat directory have source code for controller, engine and user interface for RAT. The patch directory has two files (mbus_engine.c and ui_audiotool.tcl) which need to be overwritten. They were added to process rtp.addr.change mbus command.

$ cp patch/rat/* $(RAT-DIRECTORY)/rat

$ ./configuration

$ make

In Unix:

    $make /f makefile.unix

This command will make several directories which are obj for object files and  unix for library files. The test programs are in the test directory. 

Operation

sip-mbus interface

 

sip-mbus interface Description
sipc_mbus_control NAME

sipc_mbus_control - initialize the mbus library

SYNOPSIS

#include "sip_mbus_control.h"

int sipc_mbus_control(ClientData dummy, Tcl_Interp *interp, int argc, char **argv);

The sipc_mbus_control() function provides for initialization of mbus library. 

The argv[1] argument is NULL.

sip_mbus_rtp_addr  NAME

sip_mbus_rtp_addr - change the remote IP address, src/dst port number and ttl of RAT

SYNOPSIS

#include "sip_mbus_control.h"

int sipc_mbus_rtp_addr(ClientData dummy, Tcl_Interp *interp, int argc, char **argv);

The sipc_mbus_rtp_addr() function provides for control over IP address, port number and ttl. 

The sipc_mbus_rtp_addr takes four arguments.

  • argv[1]  remote IP address
  • argv[2]  source port number
  • argv[3]  destination port number
  • argv[4]  time-to-live
sipc_mbus_talk  NAME

sipc_mbus_talk - enable/disable of talk

SYNOPSIS

#include "sip_mbus_control.h"

int sipc_mbus_talk(ClientData dummy, Tcl_Interp *interp, int argc, char**argv);

The sipc_mbus_talk() function enables or disables of talk of RAT. 

The sipc_mbus_talk takes one argument.

  • argv[1]  0: talk, 1: mute
sipc_mbus_codec  NAME

sipc_mbus_codec  - changes the codec

SYNOPSIS

#include "sip_mbus_control.h"

int sipc_mbus_codec (ClientData dummy, Tcl_Interp *interp, int argc, char**argv);

The sipc_mbus_codec () function changes the codec of RAT to encode. 

The sipc_mbus_codec  takes one argument.

  • argv[1]  
  • l16:        Linear 16, 128 kbit/s: Uncompressed 16 bit samples
  • pcma:   A-Law, 64 kbit/s: a-law companded 8 bit samples
  • pcmu:  Mu-Law, 64 kbit/s: mu-law companded 8 bit samples.
  • dvi:       DVI-ADPCM, 32 kbit/s: 16 bit samples.
  • gsm:     GSM, 13.2 kbit/s:
  • lpc:  LPC, 5.8 kbit/s
sipc_mbus_packetization NAME

sipc_mbus_packetization  - sets the number of codec frames

SYNOPSIS

#include "sip_mbus_control.h"

int sipc_mbus_codec (ClientData dummy, Tcl_Interp *interp, int argc, char**argv);

The sipc_mbus_codec () function sets the number of "units" (codec frames, typically) placed in each packet when transmitting.

The sipc_mbus_codec  takes one argument.

  • argv[1]: units: 1, 2, 4 or 8

sipc_mbus_input_gain

NAME

sipc_mbus_input_gain - controls the gain of microphone

SYNOPSIS

#include "sip_mbus_control.h"

int sipc_mbus_input_gain (ClientData dummy, Tcl_Interp *interp, int argc, char**argv);

The sipc_mbus_input_gain () function turn up or down the gain of the microphone.

The sipc_mbus_input_gain  takes one argument.

  • argv[1]: gain, percentage value

sipc_mbus_output_gain

NAME

sipc_mbus_output_gain - controls the volume of speaker

SYNOPSIS

#include "sip_mbus_control.h"

int sipc_mbus_output_gain (ClientData dummy, Tcl_Interp *interp, int argc, char**argv);

The sipc_mbus_output_gain () function turn up or down the gain of the speaker.

The sipc_mbus_output_gain  takes one argument.

  • argv[1]: gain, percentage value

sipc_mbus_rat_quit

NAME

sipc_mbus_rat_quit - makes RAT to be quit

SYNOPSIS

#include "sip_mbus_control.h"

int sipc_mbus_rat_quit (ClientData dummy, Tcl_Interp *interp, int argc, char**argv);

The sipc_mbus_rat_quit () function makes RAT to be quit without using the user interface of RAT.

The sipc_mbus_rat_quit  takes no arguments.

 

Program internal operation

sipc should spawn sip-mbus controller (sip_mbus_control.c) to send and receive mbus command to and from RAT before it uses mbus library (mbus_control.c). The sip-mbus controller not only sends mbus.hello mbus command as a heartbeat message every second to indicate liveness, but also receives mbus.hello of other mbus engines. 

sipc_mbus_control

This function should be called before other mbus-controller function calls because this initialize the mbus library. sipc_mbus_control calls sip_mbus_control() function which initializes the mbus library and sends mbus.hello command and receives it periodically. 

void sip_mbus_control () {

    /* create the mbus address of sip-mbus controller */

    /* initialization of mbus library */

    mbus_init(mbus_control_rx, mbus_err_handler, c_addr);

    while (true) {

        /* send mbus.hello command */

         mbus_send(m);

        /* mbus handler process the received mbus command */

        mbus_recv(m, m, &timeout);

    }

}

sip_mbus_rtp_addr 

sipc sends rtp.addr.change mbus command calling rtp_addr_change() of sip-mbus controller to change remote IP address, src/dst port number and ttl. Before it sends the command, it should encode them using mbus_encode_str() function. This command should be sent to the mbus_engine of RAT. If this command is being sent to  user interface or controller of RAT, they will be exit abnormally. 

mbus_qmsgf (mbus, addr_rat_engine, reliable, mbus_command, "%s %d %d %d", ip_addr, src, dst, ttl);

mbus: mbus library

addr_rat_engine: the mbus address of the mbus engine of RAT

reliable: TRUE or FALSE

mbus_command: rtp.addr.change mbus command

arguments: encoded string of "ip-addr src_port dst_port ttl".

sipc_mbus_talk, sipc_mbus_codec, sipc_mbus_packetization, sipc_mbus_input_gain, sipc_mbus_output_gain and sipc_mbus_rat_quit

All procedure is similar to rtp_addr_change() function except using different mbus commands.

sipc_mbus_talk: audio.input.mute

sipc_mbus_codec: tool.rat.codec

sipc_mbus_packetization: tool.rat.rate

sipc_mbus_input_gain: audio.input.gain

sipc_mbus_output_gain: audio.output.gain

sipc_mbus_rat_quit: mbus.quit

Test

Source Codes

All source files are sip-mbus.zip except RAT related files. RAT can be downloaded at Reliable Audio Tool (RAT)


Last updated 02/16/01