#2 was because when you sendmsg with no uuid on an outbound socket it defaults to the session who called you. I changed to code to make a distinction between not supplying a uuid and supplying an invalid uuid.
anthony, thanks for the quick reaction! we just tested you changes and it works the opposite way it should. this means: when we do not send an uuid, we get an an error (Reply-Text => -ERR invalid session id []). if we send a wrong/not existing uuid, the command will be executed on the inbound uuid.
#1 seems hard to believe. Please provide a console trace of the channel *ignoring* the hangup command.
i know it is hard to believe, we didn't believe it either ;-) have a look at http://pastebin.freeswitch.org/6367 what we simply do here: the inbound is coming in, then we do an originate and hang up the inbound. then we directly send a hangup for the outbound. the outbound will go on ringing. then, when the ringing outbound is answered, we directly get the hangup. fs gets the hangup and remembers it, but seems to wait till the answer to execute this command.