我正在尝试在c#中构建SIP PBX。我关注this tutorial。但是在完成本教程的第一部分后我陷入了困境。在我第一次运行应用程序的地方,我得到了以下控制台窗口。
现在我应该使用xlite Softphone注册SIP帐户?但对于我的生活,我无法弄清楚我应该在"帐户设置"来自xlite Softphone软件的窗口。
我的意思是Domain
,Password
,User ID
,Authorization Name
以及所有其他字段?我是这个完整主题的新手,感谢任何帮助。谢谢!
答案 0 :(得分:0)
我设法连接到该应用程序。如果有人可能感兴趣,我只是使用了以下设置。 int main()
{
const char* messageOne = "Hello world , I'm child number 1\n";
const char* messageTwo = "Hello world , I'm child number 2\n";
key_t key;
char *virtualaddr;
sem_t *get, *put;
ssize_t numRead = -1;
int shmid;
const unsigned int commLen = strlen(messageOne) + 1;
char buf[BUF_SIZE];
key = ftok("anyfile",'R');
shmid = shmget(key,1024,0644|IPC_CREAT);
if (0 > shmid)
{
perror("Shared Mem creation error\n");
exit(1);
}
//Attaching the shared mem to my address space(available across fork)
virtualaddr = shmat(shmid, (void*)0, 0);
/*Create two POSIX Named Semaphores, get and put and initialising with 0*/
get = sem_open("/get", O_CREAT|O_RDWR, 0644, 0);
put = sem_open("/put", O_CREAT|O_RDWR, 0644, 0);
// child 1
switch (fork())
{
case -1:
printf("Error forking child 1!\n");
exit(1);
case 0:
printf("\nChild 1 executing...\n");
//Referring the semaphores..
get = sem_open ("/get", O_RDWR);
put = sem_open ("/put", O_RDWR);
//Child 1 writing in shared mem
strcpy (virtualaddr, messageOne);
//Child 1 signalling that now child 2 can write
sem_post (get);
//Child1 waiting for Child2 to write..
sem_wait (put);
//Child 1 reading from shared mem
strcpy (buf, virtualaddr);
printf("Message received child ONE: %s", buf);
printf("Exiting child 1...\n");
_exit(0);
break;
default:
break;
}
// child 2
switch (fork())
{
case -1:
printf("Error forking child 2!\n");
exit(1);
case 0:
printf("\nChild 2 executing...\n");
//Referring the semaphores..
get = sem_open ("/get", O_RDWR);
put = sem_open ("/put", O_RDWR);
//Waiting Till Child 1 has written.
sem_wait (get);
//Now child 2 can read from shared memory
strcpy (buf, virtualaddr);
//Child 2 writing in shared mem
strcpy (virtualaddr,messageTwo );
//Signalling that now Child 1 can read.
sem_post (put);
printf("Exiting child 2...\n");
printf("Message received child TWO: %s", buf);
_exit(EXIT_SUCCESS);
break;
default:
break;
}
printf("Parent waiting for children completion...\n");
if (wait(NULL) == -1)
{
printf("Error waiting.\n");
exit(EXIT_FAILURE);
}
if (wait(NULL) == -1)
{
printf("Error waiting.\n");
exit(EXIT_FAILURE);
}
printf("Parent finishing.\n");
//Deleting semaphores..
sem_unlink ("/get");
sem_unlink ("/put");
//Deleting Shared Memory.
shmctl (shmid, IPC_RMID, NULL);
exit(EXIT_SUCCESS);
}
中的A
只是我选择的随机字母。它与代码或任何设置无关。 User ID
与控制台窗口中显示的IP相同。 Domain
再一个随机名称。 Display Name
与Authorization Name
相同。保持原样。