Group number and name: Group 2 - Phonedation

Team members: Min-Sik Jun (mj23) and Jangyoon Johnny Kim (jjk15)

Task number and name: Task 3 – Data Flow in Gateway

What did you set out to do? (1-2 pages) Use a figure and accompanying text to describe what you set out to do. You can reuse part of your first report if you wish. You should have sufficient detail so that someone who is not familiar with the project would still be able to understand the scope of your work. For instance, imagine giving this to a friend who is not in the class--write something that this person would be able to understand without having to ask you for help.

Task

Planned Gateway Configuration and Capability

What did you actually accomplish? (2-3 pages) Write down exactly what you managed to get done by the time of the demo. Did you achieve all the goals you set out to do? Did you do something that you didn't expect to be doing when you started?

Problems: (1-2 pages) It is possible that you did not actually accomplish what you set out to do :-( If so, why? What problems did you run into? Include both technical problems, and problems in coordinating your work with others. Be as specific as you can about technical problems. This is the only way we have to determine whether you really tried to solve the problem, instead of just giving up with token effort.

 

What you learnt: (1-2 pages) What did you learn by working on the project? Include details on technical things you learnt, as well as what you learnt about dealing with large projects, collaborating with other busy people, and dealing with other coursework.

What would you do differently next time: (1-2 pages) Everyone makes mistakes. But good learners don't repeat mistakes; they make all new ones! This project gave you a lot of freedom to make mistakes. What will you look out for the next time you undertake a large collaborative project?

  1. First of all, we would definitely have started earlier, had we known the amount of work needed to pull this off. After getting back the second report, we have practically lived in the Systems Lab(including our Thanksgiving Break) till the final demo, yet still there wee many parts of the project that we wished to improve upon.
  2. Components 1,2 and 3 were the central part of the project. In other words, if our parts didn’t work, the entire system would not become a project that allows it to be marketable and operating. From the gateway, point of view, the boundary between gateway and the other two components because very unclear as time went on. There were a lot of overlap in the requirements for the three components. For example, simple detection of phone coming in was possible by both sides. The decision of who will do it made grave changes in our implementation of the project. If we had done the project again, we would worked more closely with the components 1 and 2, rather than just trying to integrate at the end.
  3. We have assumed the integration of the components to be a very smooth ending to our semester long hard work. However, the reality was vastly different from our fantasy. It seems that to fully integrate all the application to a level that we want including all the error control and all the human interface, we would have to devote significant amount of time. Our team has concentrated on interface with the two components above(especially the team 1) to allow the basic functionality of making the voice sample to travel back and forth between phone and computer to work. We were able to accomplish this, but that left little or no time to integrate with the application teams.

Interface that your team will provide to other teams or use: Please give the exact procedure calls that you will make or support. This is your final interface spec. C/C++/Java code is OK.

Interfaces we provide to users and application teams

Upon called on the phone numbers assigned to us, 4-5522 and 4-5523, we will play voice menu. The user will be guided through as he/she enter numbers in voice menus

Voice Menu

VM1 Please enter user ID and password

VM2 choice of application

1. phone

2. join conference call

3. listen to e-mail

4. leave voice mail

5. leave personalized greetings

6. stock

7. fax

VM3 Please enter your destination ID

VM4 The conference call that you wish to join is private. Please enter the password.

VM5 Your phone connection will be terminated

VM6 Please call 254-5526 to send fax/Your call is being transferred to 254-5526 for fax

Instruction through Socket – Interface with Signaling Team

(Messages in parenthesis are what Signaling sends to Gateway)

From phone to computer

1. Gateway send USERID and Password and whether 5522/5523 to signaling

Message: N USERID Password 45522/45523

2. If password is correct, signaling will tell gateway to play VM2

Message: (VM2 45522/45523)

3. If password is incorrect signaling will tell gateway to play VM5 – Call terminated.

Message: (VM5 45522/45523)

4. Gateway receives user’s choice, ask for destination id if choice are Phone, conference or Fax and tells signaling which application the user has chosen

Choice of application 1,2,7 = D:

D 1/2/7 DestID 45522/45523

Choice of application 3,4,5,6 = C:

C 3/4/5/6 45522/45523

5. Signaling tells gateway to setup connection from 45522/45523 to (IP, port) for choices 1,3,4,5,6.

Message: (S IPnum portNum 45522/45523)

6. If conference call (2), Signaling tells Gateway if the destination ID for the conference already exist or not. If it does not exist, the user is starting a new conference.

New Conference = Q

Message: (Q IPnum portNum 45522/45523)

7. If it does exist, user is joining to the conference. Signaling detects if the conference is private or not. If private, Signaling tells Gateway to play VM4 and send password. If conference in public, Signaling tells Gateway to make calls join the conference.

Play VM4 (Password): VM4

Message: (VM4 45522/45523)

Joining Conference = M

Message: (M 45522/45523)

8. If VM4 was played, Gateway sends Password to Signaling. If Signaling verifies the password, M in step 7 will be sent. Else, VM5 of step 3 will be sent. (call termination)

Message: P passwd 45522/45523

9. If fax (7), after user enters destination ID, (after state 4) signaling would tell gateway to play VM6

Message: (VM6 45522/45523)

10. Gateway tells signaling that the connection has been made

connection = R if successful 1 or if not 0

Message: R 1/0 45522/45523

From computer to phone

1. Signaling tells gateway to setup connection to a user in computer

Message: (O IPnum portNum phoneNum 45522/45523)

2. Gateway tells that connection has been made to signaling while no phone connection has been made yet

Message: F 1/0

Using the Key words and placement of parameters, we have used the code below to actually send and receive them.

int socket_setup()

{

/* Socket setup, talk to signaling */

int winerr;

WORD ver = MAKEWORD(2,0);

WSADATA wsaData;

if ((winerr = WSAStartup(ver, &wsaData)) != 0) {

printf("WSAStartup failed: %d\n", winerr);

return -1;

}

socket_to_signaling = socket(AF_INET, SOCK_STREAM, 0);

if (socket_to_signaling == INVALID_SOCKET) {

printf("Failed socket, %d\n", WSAGetLastError());

return -1;

}

HOSTENT * host = gethostbyname("babbage.csuglab.cornell.edu");

if (!host) {

printf("Unable to resolve hostname.\n");

return -1;

}

struct sockaddr_in sa;

RtlZeroMemory(&sa, sizeof(sa));

memcpy((char*)&sa.sin_addr, host->h_addr_list[0], host->h_length);

sa.sin_family = AF_INET;

sa.sin_port = htons(4484);

if (connect(socket_to_signaling, (struct sockaddr*)&sa, sizeof(sa)) == SOCKET_ERROR)

{

printf("Failed connect (to signaling), %d\n", WSAGetLastError());

return -1;

}

printf("Connected to signaling, babbage\n");

return 0;

}

void send_to_signaling(char *buf)

{

if (send(socket_to_signaling, buf, strlen(buf),0) !=

(signed)strlen(buf)) {

printf("Failed to send to signaling, %d\n", WSAGetLastError());

} else {

printf("Sent [%s] to signaling.\n",buf);

}

return;

}

void blocking_recv_from_signaling(char *buf, int buf_size)

{

int x = recv(socket_to_signaling, buf, buf_size,0);

if (x >= 0) buf[x] = 0;

printf("Got [%s] from signaling returns %d.\n",buf,x);

return;

}

 

 

 

 

 

Interfaces of other teams we use

Only teams we communicate with are Data exchange team and Signaling Team. We do not use interfaces of Signaling because all communication between Signaling and Gateway are done through sockets. We do use Data Exchange Team’s interface. Because Data Exchange Team Coded in C, (speed consideration) we included their code in our own program. By connecting to same machine and port, we are able to transfer data back and forth.

Team 1’s Functions

Following is the function prototype of the functions provided by team 1

Connection EstablishConnection(ConnectionParameters p, char **error);

int DestroyConnection(Connection c);

int ModifyConnection(Connection c, ConnectionParamenter p);

int UDP_SendMessage(Connection c, char *buf, int buf_size);

long UDP_RecvMessage(Connection c, char *buf, long buf_size, long msec, long *sender_ip_addr);

Here is how we have used them in our code.

ConnectionParameters p[2];

Connection c[2] = {NULL, NULL};

int MakeConnection(int chNum, char outFile[8], char destName[9], int portNum)

{

int newChNum = chNum+2;

int chkStatus;

if

DX_IOTT rec_iott;

memset(&rec_iott, 0, sizeof(DX_IOTT));

rec_iott.io_fhandle=dx_fileopen(outFile,_O_RDWR|_O_CREAT|_O_TRUNC|O_BINARY,0666);

rec_iott.io_bufp = 0;

rec_iott.io_offset = (unsigned long) 0;

rec_iott.io_length = -1;

rec_iott.io_type = IO_DEV|IO_EOT;

DV_TPT test_tpt[2];

if (dx_clrtpt(test_tpt, 2) == -1)

printf("Cannot clear the TPT for the play \n");

if ((status[chNum] == VOICE_EMAIL) || (status[chNum] == STOCK))

{

test_tpt[0].tp_type = IO_CONT;

test_tpt[1].tp_type = IO_EOT;

test_tpt[0].tp_termno = DX_LCOFF;

test_tpt[0].tp_length = 1;

test_tpt[1].tp_termno = DX_DIGMASK;

test_tpt[1].tp_length = DM_P;

test_tpt[1].tp_flags = TF_DIGMASK;

}

else

{

test_tpt[0].tp_type = IO_EOT;

test_tpt[0].tp_termno = DX_LCOFF;

test_tpt[0].tp_length = 1;

}

DX_XPB* test_xpb;

test_xpb = new DX_XPB;

test_xpb->wFileFormat = FILE_FORMAT_VOX;

test_xpb->wDataFormat = DATA_FORMAT_PCM;

test_xpb->nSamplesPerSec = DRT_11KHZ;

test_xpb->wBitsPerSample = 8;

status[newChNum] = PHONE_REC;

if(dx_reciottdata(chdev[newChNum], &rec_iott, test_tpt, test_xpb, EV_ASYNC) == -1){

printf("Error : issuing dx_reciottdata on device %s \n", ATDV_NAMEP(chdev[newChNum]));

printf("Error is 0x%x %s\n", ATDV_LASTERR(chdev[newChNum]),ATDV_ERRMSGP(chdev[newChNum]));

}

if (chNum) RtlZeroMemory(playbuf1,sizeof(playbuf1));

else RtlZeroMemory(playbuf0,sizeof(playbuf0));

p[chNum] = (ConnectionParameters)calloc(1,sizeof(*(p[chNum])));

*(int *)&(p[chNum]->input.type) = 6;

strcpy((p[chNum])->input.file_name, outFile);

p[chNum]->input.loop_file = 1;

*(int *)&(p[chNum]->output.type) = 6;

if (chNum)

{

p[chNum]->output.ringbuffer = (unsigned char *)playbuf1;

p[chNum]->output.ringbuffer_size = sizeof(playbuf1);

}

else

{

p[chNum]->output.ringbuffer = (unsigned char *)playbuf0;

p[chNum]->output.ringbuffer_size = sizeof(playbuf0);

}

p[chNum]->output.ringbuffer_offset = 0;

char fn[30];

sprintf(fn, "%s.csuglab.cornell.edu", destName);

p[chNum]->dest.name = fn;

p[chNum]->dest.port = portNum;

/*

p[chNum]->dest.name = "brussels.cs.cornell.edu";

p[chNum]->dest.port = 5474;

*/

p[chNum]->primary_encoding = 8;

p[chNum]->secondary_encoding = 0;

p[chNum]->size = MIN_SIZE*4;

char* error;

printf("InFile = [%s]\n",((p[chNum])->input.file_name));

c[chNum] = EstablishConnection(p[chNum], &error);

if (!c[chNum])

{

printf("Error: %s\n", error);

status[chNum] = TERMINATE;

}

if (status[chNum] != TERMINATE) chkStatus = 1;

else chkStatus = 0;

char buffer[256];

if (status[chNum] != FROM_COM)

{

sprintf(buffer, "R %d 4552%d", chkStatus, newChNum);

send_to_signaling(buffer);

conStatus[chNum] = 1;

}

Sleep(3000);

DX_IOTT* play_iott;

play_iott = new DX_IOTT;

play_iott->io_type = IO_MEM|IO_EOT;

play_iott->io_length = -1;

play_iott->io_offset = 0;

if(chNum) play_iott->io_bufp = playbuf1;

else play_iott->io_bufp = playbuf0;

if (status[chNum] != TERMINATE) status[chNum] = PHONE_PLAY;

printf("ready to play\n");

if(dx_playiottdata(chdev[chNum], play_iott, test_tpt, test_xpb, EV_ASYNC) == -1) {

printf("Error : issuing dx_playiottdata on device %s \n", ATDV_NAMEP(chdev[chNum]));

printf("Error is 0x%x %s\n", ATDV_LASTERR(chdev[chNum]),ATDV_ERRMSGP(chdev[chNum]));

}

return 0;

}

 

 

 

 

 

 

 

 

Advice for the course staff: What mistakes did we make in running this project? Please help us improve the course.

References: What sources did you consult in working out the details of your project? URLs for Web pages are acceptable for references.

Meeting with Prof. Keshav on Sept. 25th, 1998

C. Wu and J. Irwin, "Emerging Multimedia Computer Communication"

H. Schulzrinne and J. Rosenberg, "Internet Telephony: Architecture and Protocols an IETF Perspective"

H. Schulzrinne and J. Rosenberg, "Internet Telephony Gateway Location," in Proceedings of the Conference on Computer

Communications (IEEE Infocom), (San Francisco, California) March/April 1998.

Sample C++ Code,

http://www.cs.cornell.edu/cs519/project/examples/gateway/dialog_example.cpp.txt

D/41ESC Manual, http://www.cs.cornell.edu/cs519/project/Doc/Dialogic/

D/41ESC description, http://www.dialogic.com/products/d_sheets/2550web.htm

D/41ESC description, (PDF) ftp://ftp.dialogic.com/www/pdf/2550fn05.pdf

D/41ESC documentation http://www.dialogic.com/products/d_sheets/2550web.htm