Hmm... you must be wondering why I call him so. Because he is of dubious character. He appears nice outside and what does he do within?
I got a feel of it when I was writing the channel. I wrote the skeleton channel and made an entry for that in extensions.conf.
exten => 200,1,Dial(Sarin/200)
exten => 200,n,Hangup()
From the console do "console dial 200". Then I got a message that "Couldn't call 200". I checked again and again to find what has gone wrong. Nothing as far as I could see.
Then I enabled debug mode. To enable the debug mode in asterisk, I had to do two things.
1.1 Edit the /etc/asterisk/logger.conf.
1.2 Look for a line that looks like "console => notice,warning,error"
1.3 Add debug to that list. "console => notice,warning,error,debug"
2. Now start asterisk with debug option. "asterisk -vvvdc"
(This for enabling debug prints on console)
Then, when I tried to call that number, I found that response from "ast_call" indicates a failure. And, what was causing it?
ast_call checks ast_check_hangup. Inside that function, there is this block of code:
if (!chan->tech_pvt) /* yes if no technology private data */
Shame on you asterisk. You were checking the private elements of a channel!. You had no business poking around that pointer. It is private to the channel and it is upto the channel to decide to have it or not to have it (have it as NULL). If you wanted to do anything with it, you should not have called it pvt!
Anyway, I assigned a int pointer to it and then things went fine.