This is my code;
if (i != 0)
{
printf ("Couldn't initialize eXosip!\n");
}
else
{
printf ("eXosip_init successfully!\n");
}
i = eXosip_listen_addr (IPPROTO_UDP, NULL, 5061, AF_INET, 0);
if (i != 0)
{
eXosip_quit ();
fprintf (stderr, "Couldn't initialize transport layer!\n");
// return -1;
}
printf("\t***********************************************\n");
printf("\t*****************Menu*************************\n");
printf("\t***********************************************\n");
printf ("\tVoici la liste d'actions que vous pouvez accomplir:\n r:s'enregistrer\n i: envoyer une requête invite \n l: Rester en ligne \n f: renvoyer un appel \n");
printf ("\tSVP choissisez une commande :\n");
scanf ("%c", &command);
getchar ();
int flag1=1;
int flag = 1;
while (flag)
{
switch (command)
{
case 'i':
printf ("\t Tapez SVP l'adresse de l'hôte que vous voulez joindre\n");
char ad;
scanf ("%s", &ad);
char *add=&ad;
i = eXosip_call_build_initial_invite (&invite, add, source_call, NULL, "This is a call for a conversation");
if (i != 0)
{
printf ("Initial INVITE failed!\n");
}
osip_message_set_supported (invite, "100rel");
snprintf (tmp, 4096,
"v=0\r\n"
"o=sandra 0 0 IN IP4 192.168.1.25\r\n"
"t=1 10\r\n"
"a=username:sandra\r\n"
"a=password:123\r\n"
"a=rtpmap:104 X-G72x24/16000\r\n"
"a=rtpmap:108 X-G72xH/8000\r\n"
"a=rtpmap:9 G722/8000\r\n"
"a=rtpmap:18 G729/8000\r\n"
"a=rtpmap:4 G723/8000\r\n"
"amrtpmap:8 PCMA/8000\r\n"
"a=rtpmap:0 PCMU/8000\r\n"
"a=rtpmap:116 telephone-event/8000\r\n"
"a=fmtp:116 0-15\r\n"
"m=video 6002 RTP/AVP 96 97 34 31\r\n"
"b=TIAS:224000\r\n"
"b=AS:224\r\n"
"a=rtpmap:96 H264/90000\r\n"
"a=maxprate:23.0\r\n"
"a=fmtp:96 profile-level-id=428014\r\n"
"a=sendrecv\r\n"
"a=rtpmap:97 H263-1998/90000\r\n"
"a=fmtp:97 CIF=1;QCIF=1;I=1;J=1;T=1;N=4;K=1\r\n"
"a=rtpmap:34 H263/90000\r\n"
"a=fmtp:34 CIF=1;QCIF=1\r\n"
"a=rtpmap:31 H261/90000\r\n"
"a=fmtp:31 CIF=1;QCIF=1\r\n"
"m=data 6004 RTP/AVP 115\r\n"
"a=rtpmap:115 X-ATOR/1000\r\n"
"a=sendrecv\r\n");
osip_message_set_body (invite, tmp, strlen(tmp));
osip_message_set_content_type (invite, "application/sdp");
int j;
int flag1=1;
eXosip_lock ();
i = eXosip_call_send_initial_invite (invite);
eXosip_unlock ();
printf ("\t---------------------------------------------\n");
printf ("\t----------Déroulement de l'appel-------------\n");
printf ("\t---------------------------------------------\n");
while (flag1)
{
je = eXosip_event_wait (0, 200);
if (je == NULL)
{
// printf ("No response or the time is over!\n");
continue;
}
switch (je->type)
{
case EXOSIP_CALL_INVITE:
printf ("a new invite received!\n");
break;
case EXOSIP_CALL_PROCEEDING:
printf ("Appel en cours de traitement!\n");
continue;
case EXOSIP_CALL_RINGING:
printf ("ringing!\n");
printf ("call_id is %d, dialog_id is %d \n", je->cid, je->did);
break;
case EXOSIP_CALL_ANSWERED:
call_id = je->cid;
dialog_id = je->did;
printf ("call_id is %d, dialog_id is %d \n", je->cid, je->did);
eXosip_call_build_ack (je->did, &ack);
eXosip_call_send_ack (je->did, ack);
printf ("votre correspondant a accepté votre appel \n");
printf(" \t ----------Début de la conversation---------\n");
flag1 = 0;
break;
case EXOSIP_CALL_CLOSED:
printf ("Votre correspondant a mis fin à l'appel!\n");
eXosip_lock ();
i = eXosip_call_build_answer (je->tid, 200, &answer);
if (i != 0)
{
eXosip_call_send_answer (je->tid, 400, NULL);
}
eXosip_call_send_answer (je->tid, 200, answer);
eXosip_unlock ();
break;
case EXOSIP_CALL_ACK:
printf ("ACK received!\n");
break;
case EXOSIP_CALL_CANCELLED:
printf ("appel rejeté\n");
break;
case EXOSIP_CALL_RELEASED:
printf ("appel interrompu");
break;
default:
printf ("other response!\n");
char t;
t=je->textinfo;
printf ("voila l'evenement %c\n", t);
break;
}
eXosip_event_free (je);
}
Any help will be very grateful!