func: static int handle_offhook_message(struct skinny_req *req, struct skinnysession *s) struct skinny_device * d = s -> device ; struct skinny_subchannel * sub = NULL ; int instance ; int reference ; instance = letohl ( req -> data . offhook . instance ); reference = letohl ( req -> data . offhook . reference ); if ( d -> hookstate == SKINNY_OFFHOOK )  if ( reference )  sub = find_subchannel_by_instance_reference ( d , instance , reference ); l = sub -> line; if ( ! sub )  if ( instance )  l = find_line_by_instance ( d , instance ); l = d -> activeline; sub = l -> activesub; d -> hookstate = SKINNY_OFFHOOK; if ( sub && sub -> substate == SUBSTATE_HOLD )  if ( sub && sub -> calldirection == SKINNY_INCOMING )  transmit_definetimedate ( d ); static void transmit_definetimedate(struct skinny_device *d) struct skinny_req * req ; struct timeval now = ast_tvnow ( ) ; struct ast_tm cmtime ; if ( ! ( req = req_alloc ( sizeof ( struct definetimedate_message ) , DEFINETIMEDATE_MESSAGE ) ) )  req -> data . definetimedate . year = htolel ( cmtime . tm_year + 1900 ); req -> data . definetimedate . month = htolel ( cmtime . tm_mon + 1 ); req -> data . definetimedate . dayofweek = htolel ( cmtime . tm_wday ); req -> data . definetimedate . day = htolel ( cmtime . tm_mday ); req -> data . definetimedate . hour = htolel ( cmtime . tm_hour ); req -> data . definetimedate . minute = htolel ( cmtime . tm_min ); req -> data . definetimedate . seconds = htolel ( cmtime . tm_sec ); req -> data . definetimedate . milliseconds = htolel ( cmtime . tm_usec / 1000 ); req -> data . definetimedate . timestamp = htolel ( now . tv_sec ); transmit_response ( d , req ); static void transmit_response(struct skinny_device *d, struct skinny_req *req) transmit_response_bysession ( d -> session , req ); static int transmit_response_bysession(struct skinnysession *s, struct skinny_req *req) if ( ! s )  if ( ( letohl ( req -> len ) > SKINNY_MAX_PACKET ) || ( letohl ( req -> len ) < 0 ) )  memset ( s -> outbuf , 0 , sizeof ( s -> outbuf ) ); memcpy ( s -> outbuf , req , skinny_header_size ); memcpy ( s -> outbuf + skinny_header_size , & req -> data , letohl ( req -> len ) ); res = write ( s -> fd , s -> outbuf , letohl ( req -> len ) + 8 ); if ( res != letohl ( req -> len ) + 8 )  ast_log ( LOG_WARNING , "Transmit: write only sent %d out of %d bytes: %s\n" , res , letohl ( req -> len ) + 8 , strerror ( errno ) ); if ( res == - 1 )  