⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gateip.c

📁 dialogic voip 测试代码
💻 C
📖 第 1 页 / 共 2 页
字号:
				                	IPCapability->capability,

					                IPCapability->type,

					                IPCapability->direction));

					}

				}

			}

			break;			









		case IPSET_VENDORINFO:

			switch (parmp->parm_ID)

			{

			case IPPARM_H221NONSTD:

				{

					if(parmp->value_size == sizeof(IP_H221NONSTANDARD)){

						IP_H221NONSTANDARD *pH221NonStandard;

					    pH221NonStandard = (IP_H221NONSTANDARD *)(&(parmp->value_buf));

					    gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data H221NONSTANDARD: country_code %d,extension %d, manufacturer_code %d\n",

					             pH221NonStandard->country_code,

		   			             pH221NonStandard->extension,

					             pH221NonStandard->manufacturer_code));

					}

				}

				break;



			case IPPARM_VENDOR_PRODUCT_ID:

				if(parmp->value_size != 0){

					gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data  IPPARM_VENDOR_PRODUCT_ID %s\n",parmp->value_buf));

				}

				break;



			case IPPARM_VENDOR_VERSION_ID:

				if(parmp->value_size != 0){

					gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data  IPPARM_VENDOR_VERSION_ID %s\n",parmp->value_buf));

				}

				break;



			default:

				gateWARNING(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot unknown VENDORINFO extension parmID %d\n",parmp->parm_ID)); 

				break;		



			}/* end switch (parmp->parm_ID) for IPSET_VENDORINFO */

	    	break;









	    case IPSET_MSG_Q931:



			switch (parmp->parm_ID)

			{

				case IPPARM_MSGTYPE:

			

			     switch ((*(int *)(parmp->value_buf)))

				 {  



					case IP_MSGTYPE_Q931_FACILITY:

						chanInfoIP[Channel].Q931Facility_Evt++;

    					gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data IP_MSGTYPE_Q931_FACILITY\n"));

						break;



					case IP_MSGTYPE_Q931_INFORMATION:

    					gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data IP_MSGTYPE_Q931_INFORMATION\n"));

						break;



					case IP_MSGTYPE_Q931_PROGRESS:

    					gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data IP_MSGTYPE_Q931_PROGRESS\n"));

						break;



					default:

						gateWARNING(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\t   Got unknown MSG_Q931 extension parmID %d\n",parmp->parm_ID)); 

						break;

				 } /* end  switch ((int)(parmp->value_buf)) */

			

			}/* end switch (parmp->parm_ID) for IPSET_MSG_Q931 */

			break;





		case IPSET_MSG_H245:



			switch (parmp->parm_ID)

			{



			 case IPPARM_MSGTYPE:

			

			     switch ((*(int *)(parmp->value_buf)))

				 {  

                  case IP_MSGTYPE_H245_INDICATION:



					chanInfoIP[Channel].UII_Evt++;

    				gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data IP_MSGTYPE_H245_INDICATION\n"));

					break;

				 



			      case IP_MSGTYPE_H245_COMMAND:



					chanInfoIP[Channel].NonStdCmd_Evt++;

    				gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data IP_MSGTYPE_H245_COMMAND\n"));

					break;



				 

				  case IP_MSGTYPE_H245_REQUEST:

					gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data IP_MSGTYPE_H245_REQUEST\n"));

					break;



			      case IP_MSGTYPE_H245_RESPONSE:

				    gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data IP_MSGTYPE_H245_RESPONSE\n"));

				    break;



				  case IP_MSGTYPE_H245_UNDEFINED:

					gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data IP_MSGTYPE_H245_UNDEFINED\n"));

					break;

	

				  default:

					gateWARNING(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\t   Got unknown MSG_H245 extension parmID %d\n",parmp->parm_ID)); 				

					break;

				 } /* end  switch ((int)(parmp->value_buf)) */

			}/* end switch (parmp->parm_ID) for IPSET_MSG_H245 */

			break;











        

		case IPSET_USERINPUTINDICATION:



			switch (parmp->parm_ID)

			{

				

				case IPPARM_UII_ALPHANUMERIC:

					gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data  IPPARM_UII_ALPHANUMERIC: %s\n",parmp->value_buf));

	                break;



		        default:

					gateWARNING(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\t   Got unknown USERINPUTINDICATION extension parmID: %d\n",parmp->parm_ID)); 

				    break;

				 

			}/* end switch (parmp->parm_ID) for IPSET_USERINPUTINDICATION */

		    break;









			

		case IPSET_NONSTANDARDDATA:



			switch (parmp->parm_ID)

			{				



			case IPPARM_NONSTANDARDDATA_DATA:

				gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data  IPPARM_NONSTANDARDDATA_DATA: %s\n",parmp->value_buf));

				break;



			case IPPARM_NONSTANDARDDATA_OBJID:

				

				gateINFO(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\tGot extension data  IPPARM_NONSTANDARDDATA_OBJID: %s\n",parmp->value_buf));

	            break;



		    default:

				gateERROR(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\t   Got unknown NONSTANDARDDATA extension parmID %d\n",parmp->parm_ID)); 

				break;

				 

			}/* end switch (parmp->parm_ID) for IPSET_NONSTANDARDDATA */

		    break;









		default:

			gateWARNING(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\t   Got unknown extension setID %d\n",parmp->set_ID)); 

			break;

		}/* end switch (parmp->set_ID) */

	} 

	gateTRACE(Channel,_logLevel,Session[Channel].LogFile, (Session[Channel].LogFile,"\t   End of OnExtension function on channel %d\n",Channel));



}







/*****FUNCTION***************************************************

*        NAME : ipGetEvent

* DESCRIPTION : First process of ip events

*       INPUT : None

*      OUTPUT : None

*     RETURNS : 1 - success, 0 - fail

*    CAUTIONS : None

****************************************************************/

int ipGetEvent(METAEVENT *metaevt,unsigned int Channel)

{

   int				cclibid;    /* cclib id for gc_ErrorValue() */ 

   char				*msg_error; /* points to the error message string */

   int		        gc_result;

   long			    cclib_result;



   gateTRACE(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"\t   In ipGetEvent function on channel %d\n",Channel));



   switch(metaevt->evttype){

		 

         case GCEV_ACCEPT:

		 case GCEV_ANSWERED:

		 case GCEV_DROPCALL:

		 case GCEV_CONNECTED:

         case GCEV_RESETLINEDEV:

         case GCEV_DETECTED:

		 case GCEV_UNBLOCKED:

		 case GCEV_ALERTING:

		 case GCEV_PROCEEDING:

			 break;





         case GCEV_OFFERED:

			 {

				 if(Session[Channel].ipParams.currentCRN == 0){

				    Session[Channel].ipParams.currentCRN = metaevt->crn;

				 }

				 else { 

					 /* Here we don't know if this CRN is next CRN or glare CRN,

					    it will be decided in the state machine */

				    Session[Channel].ipParams.nextCRN = metaevt->crn;

				 }

				 if (DnisEnable){

					 if (gc_GetDNIS(Session[Channel].ipParams.currentCRN,Session[Channel].DNIS)<0) {

				        gateERROR(Channel,_logLevel,Session[Channel].LogFile, (Session[Channel].LogFile, "Failed to get DNIS\n"));

					 }

				 }



			 }

			 break;		   



         case GCEV_EXTENSION:

			 {

				 GC_PARM_BLKP        gcParmBlk;

				 EXTENSIONEVTBLK     *pextensionBlk; 



                 pextensionBlk = (EXTENSIONEVTBLK *)(metaevt->extevtdatap);

                 gcParmBlk = (&(pextensionBlk->parmblk));

				 OnExtension(gcParmBlk,Channel);

			 }

			 break;	





		 case GCEV_DISCONNECTED:

			  /* Get the reason of Disconnecting */

	         gc_ResultValue(metaevt, &gc_result, &cclibid, &cclib_result);

			 if (gc_ResultMsg(cclibid, cclib_result, &msg_error)==0) {

				   gateTRACE(Channel,_logLevel,Session[Channel].LogFile, (Session[Channel].LogFile, "Got GCEV_DISCONNECTED. Reason: %s ",msg_error));

			 }

             break;



		 case GCEV_TASKFAIL:

 			 gc_ResultValue(metaevt, &gc_result, &cclibid, &cclib_result);

			 if (gc_ResultMsg(cclibid, cclib_result, &msg_error)==0) {

				   gateFATAL(Channel,_logLevel,Session[Channel].LogFile, (Session[Channel].LogFile, "Got GCEV_TASKFAIL. Reason: %s ",msg_error));

			 }

			 break;



         case GCEV_CALLSTATUS:

 			 gc_ResultValue(metaevt, &gc_result, &cclibid, &cclib_result);

				if (gc_ResultMsg(cclibid, cclib_result, &msg_error)==0) {

				   gateFATAL(Channel,_logLevel,Session[Channel].LogFile, (Session[Channel].LogFile, "Got GCEV_CALLSTATUS. Reason: %s ",msg_error));

				}

			 break;

		 default:

			 gateWARNING(Channel,_logLevel,Session[Channel].LogFile, (Session[Channel].LogFile, "UnKnown GC event (0x%x)\n",metaevt->evttype));

			 return FUNCSUCCESS;

			 break;



      } /* End  of switch(metaevt.evttype) */



	     /* We have an event run the state machine function for this channel  */

	  if((*(Session[Channel].stateFxn))(Channel,IP,metaevt->evttype,NULL) != FUNCSUCCESS) {

		  gateFATAL(Channel,_logLevel,Session[Channel].LogFile,(Session[Channel].LogFile,"State Machine Error on Channel %d, event %s\n", Channel, gateEventStr(metaevt->evttype)));

	      return(FUNCFAIL);

	  }



      gateTRACE(Channel,_logLevel,Session[Channel].LogFile, (Session[Channel].LogFile,"\t   End of ipGetEvent function on channel %d\n",Channel));

	  return FUNCSUCCESS;

		  

} /* Function ipGetEvent */







/*****FUNCTION***************************************************

*        NAME : util_malloc

* DESCRIPTION : Allocate memory

*       INPUT : None

*      OUTPUT : None

*     RETURNS : 1 - success, 0 - fail

*    CAUTIONS : None

****************************************************************/

void * util_malloc( long size, int init_val, unsigned int Channel)

{

  	void *ptr;



  	ptr=malloc(size);

  	if(ptr == NULL)

  	{

		gateFATAL(Channel,_logLevel,Session[Channel].LogFile, (Session[Channel].LogFile,"\t   Could not allocate memory\n"));

	    exit(0);

  	}



  	/* initialize allocated memory*/

  	memset(ptr, init_val, size);

  	return ptr;

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -